/* Reset e Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Tecnináutica Brand Colors */
    --primary-color: #cc0000; /* Vermelho Tecnináutica */
    --secondary-color: #990000; /* Vermelho Escuro */
    --accent-color: #ff3333; /* Vermelho Claro */
    --success-color: #00a651; /* Verde */
    --warning-color: #ff9900; /* Laranja */
    --danger-color: #cc0000; /* Vermelho */
    --dark-color: #000000; /* Preto */
    --light-color: #ffffff; /* Branco */
    --border-color: #e0e0e0; /* Cinza Claro */
    --text-color: #000000; /* Preto */
    --text-light: #666666; /* Cinza */
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

html, body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--light-color);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem 2rem;
    flex: 1;
    box-sizing: border-box;
}

/* Banner de Licença Expirada */
.licenca-expirada-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: linear-gradient(135deg, #ff4444 0%, #cc0000 100%);
    color: white;
    padding: 0.75rem 2rem;
    z-index: 1001;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.licenca-expirada-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 100%;
    margin: 0 auto;
    font-size: 0.95rem;
}

.licenca-expirada-content i {
    font-size: 1.25rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

.licenca-expirada-content a {
    color: white;
    text-decoration: underline;
    font-weight: 600;
    transition: opacity 0.2s;
}

.licenca-expirada-content a:hover {
    opacity: 0.8;
}

/* Header */
.header {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 3px solid var(--dark-color);
    backdrop-filter: blur(10px);
    isolation: isolate;
}

/* Ajustar header quando há banner de licença expirada */
body.licenca-expirada .header {
    top: 50px;
}

body.licenca-expirada main {
    margin-top: 50px;
}

.header-content {
    width: 100%;
    margin: 0 auto;
    padding: 0.75rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    min-height: 70px;
}

.header-logo-left {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    color: white !important;
    transition: transform 0.2s ease;
}

.logo-link:hover {
    transform: translateY(-2px);
}

.header-logo-img {
    height: 50px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.header-logo-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    font-size: 1.75rem;
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.header-logo-name {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    line-height: 1.2;
    color: white !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1001;
}

.mobile-menu-toggle span {
    width: 25px;
    height: 3px;
    background: white;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

.nav {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
    position: relative;
    z-index: 1;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 0.75rem;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    font-weight: 500;
    font-size: 0.95rem;
    position: relative;
    overflow: visible;
}

/* Tooltips dinâmicos criados via JavaScript */
.nav-tooltip {
    position: fixed !important;
    background-color: rgba(0, 0, 0, 0.95) !important;
    color: white !important;
    padding: 0.5rem 0.75rem !important;
    border-radius: 6px !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    white-space: nowrap !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.25s ease, transform 0.25s ease !important;
    z-index: 2147483647 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
    transform: translateX(-8px) !important;
    margin: 0 !important;
    border: none !important;
}

.nav-tooltip.visible {
    opacity: 1 !important;
    transform: translateX(0) !important;
}

.nav-tooltip-arrow {
    position: fixed !important;
    width: 0 !important;
    height: 0 !important;
    border: 6px solid transparent !important;
    border-right-color: rgba(0, 0, 0, 0.95) !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.25s ease !important;
    z-index: 2147483646 !important;
    transform: translateY(-50%) !important;
    margin: 0 !important;
}

.nav-tooltip-arrow.visible {
    opacity: 1 !important;
}

.nav-link i {
    font-size: 1.25rem;
    width: auto;
    text-align: center;
    position: relative;
    z-index: 0;
}

.nav-link span {
    display: none;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.nav-link.active {
    background-color: var(--dark-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    font-weight: 600;
    position: relative;
    border-bottom: 3px solid white;
    border-radius: 50% 50% 0 0;
    padding-bottom: calc(0.75rem - 3px);
}

/* Quando hover no link ativo, o tooltip deve aparecer normalmente */
.nav-link.active:hover::after {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
    transition-delay: 0.1s;
}

@media (max-width: 1024px) {
    .header-content {
        padding: 0.75rem 1rem;
    }
    
    .header-logo-img {
        height: 40px;
        filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    }
    
    .header-logo-icon {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }
    
    .header-logo-name {
        font-size: 1.25rem;
    }
    
    .nav-link span {
        display: none;
    }
    
    .nav-link {
        padding: 0.625rem;
        border-radius: 50%;
        width: 44px;
        height: 44px;
        justify-content: center;
    }
    
    .nav-link i {
        font-size: 1.25rem;
    }
}

/* Dashboard */
.dashboard h1 {
    margin-bottom: 2rem;
    color: var(--dark-color);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 0.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.stat-info h3 {
    font-size: 2rem;
    font-weight: bold;
    color: var(--dark-color);
    margin-bottom: 0.25rem;
}

.stat-info p {
    color: var(--text-light);
    font-size: 0.875rem;
}

/* Tabelas */
.recent-section {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.recent-section h2 {
    margin-bottom: 1.5rem;
    color: var(--dark-color);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table thead {
    background-color: var(--light-color);
}

table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--dark-color);
    border-bottom: 2px solid var(--border-color);
}

table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

table tbody tr:hover {
    background-color: var(--light-color);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
}

.badge-pendente {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-em_andamento {
    background-color: #ffe6e6;
    color: #cc0000;
}

.badge-finalizada {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-cancelada {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-rascunho {
    background-color: #f3f4f6;
    color: #374151;
}

.badge-enviada_api {
    background-color: #ffe6e6;
    color: #cc0000;
}

/* Botões */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--secondary-color);
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: #008a45;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #b30000;
}

.btn-warning {
    background-color: var(--warning-color);
    color: white;
}

.btn-warning:hover {
    background-color: #e68900;
}

.btn-info {
    background-color: #17a2b8;
    color: white;
}

.btn-info:hover {
    background-color: #138496;
}

.d-flex {
    display: flex;
}

.gap-2 {
    gap: 0.5rem;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

/* Formulários */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark-color);
}

.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 1rem;
    background-color: white;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* Cards */
.card {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.page-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem 0;
}

.page-logo img {
    max-height: 60px;
    width: auto;
    object-fit: contain;
}

.page-logo .logo-icon {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(204, 0, 0, 0.1);
    border-radius: 12px;
    font-size: 2rem;
    color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dark-color);
}

/* Alertas */
.alert {
    padding: 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1.5rem;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-info {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* Footer */
.footer {
    background-color: var(--dark-color);
    color: white;
    padding: 0.5rem 2rem;
    margin-top: auto;
    flex-shrink: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.footer-left {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 500;
}

.footer-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    flex-wrap: wrap;
}

.footer-right a {
    color: white;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.footer-right a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.licenca-info {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.licenca-ativa {
    color: #10b981;
    font-size: 1rem;
    animation: pulse 2s infinite;
}

.licenca-expirada {
    color: #ef4444;
    font-size: 1rem;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .licenca-expirada-banner {
        padding: 0.5rem 1rem;
    }
    
    .licenca-expirada-content {
        font-size: 0.85rem;
        flex-wrap: wrap;
    }
    
    .licenca-expirada-content i {
        font-size: 1.1rem;
    }
    
    body.licenca-expirada main {
        margin-top: 60px;
    }
    
    body.licenca-expirada .header {
        top: 60px;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .header-content {
        padding: 0.75rem 1rem;
    }
    
    .logo-name {
        font-size: 1.25rem;
    }
    
    .logo-img, .logo-icon {
        height: 40px;
        width: 40px;
    }
    
    .logo-icon {
        font-size: 1.5rem;
    }

    .nav {
        position: fixed;
        top: 70px;
        left: -100%;
        width: 100%;
        background: var(--primary-color);
        flex-direction: column;
        padding: 1rem;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        transition: left 0.3s ease;
        gap: 0.5rem;
        max-height: calc(100vh - 70px);
        overflow-y: auto;
    }
    
    .nav.active {
        left: 0;
    }
    
    .nav-link {
        width: 100%;
        padding: 1rem;
        border-radius: 8px;
        justify-content: flex-start;
        width: auto;
        height: auto;
    }
    
    .nav-link span {
        display: inline;
        margin-left: 0.75rem;
    }
    
    .nav-link.active::after {
        display: none;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }
    
    .footer-left,
    .footer-right {
        justify-content: center;
        width: 100%;
    }

    .container {
        padding: 1rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    @media (max-width: 768px) {
        .stats-grid {
            grid-template-columns: 1fr;
        }
    }

    .table-container {
        font-size: 0.875rem;
    }
}

/* Arquivos Digitais */
.upload-area {
    margin-bottom: 2rem;
}

.upload-dropzone {
    border: 2px dashed var(--border-color);
    border-radius: 0.5rem;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: #fafafa;
}

.upload-dropzone:hover {
    border-color: var(--primary-color);
    background: #f0f8ff;
}

.upload-dropzone p {
    margin: 0.5rem 0;
    color: var(--text-color);
    font-weight: 500;
}

.upload-dropzone small {
    color: var(--text-light);
}

.arquivos-lista {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.arquivo-item {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s;
}

.arquivo-item:hover {
    box-shadow: var(--shadow-lg);
}

.arquivo-item.arquivo-uploading {
    opacity: 0.7;
}

.arquivo-preview {
    width: 100%;
    height: 150px;
    margin-bottom: 0.75rem;
    border-radius: 0.25rem;
    overflow: hidden;
    background: #f9f9f9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.arquivo-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    cursor: pointer;
    display: block;
    background: #f9f9f9;
}

.arquivo-preview i {
    font-size: 3rem;
    color: var(--text-light);
}

.arquivo-info {
    flex: 1;
    margin-bottom: 0.75rem;
}

.arquivo-info strong {
    display: block;
    margin-bottom: 0.25rem;
    color: var(--text-color);
    font-size: 0.9rem;
    word-break: break-word;
}

.arquivo-info small {
    display: block;
    color: var(--text-light);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.arquivo-info p {
    margin-top: 0.5rem;
    color: var(--text-light);
    font-size: 0.85rem;
}

.arquivo-acoes {
    display: flex;
    gap: 0.5rem;
}

.arquivo-acoes .btn {
    flex: 1;
    padding: 0.5rem;
    text-align: center;
}

.arquivo-progresso {
    width: 100%;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.progresso-bar {
    height: 100%;
    background: var(--primary-color);
    width: 0%;
    animation: progresso 1.5s ease-in-out infinite;
}

@keyframes progresso {
    0% {
        width: 0%;
    }
    50% {
        width: 70%;
    }
    100% {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .arquivos-lista {
        grid-template-columns: 1fr;
    }
}

/* Utilitários */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.d-flex {
    display: flex;
}

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

