/* ============================================
   VARIÁVEIS E RESET GLOBAL
   ============================================ */
:root {
    --primary-color: #1e40af;
    --primary-dark: #1e3a8a;
    --secondary-color: #06b6d4;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --bg-color: #f8fafc;
    --bg-secondary: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ============================================
   CONTAINER E LAYOUT PRINCIPAL
   ============================================ */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ============================================
   HEADER
   ============================================ */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 40px 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.header .subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* ============================================
   UPLOAD SECTION
   ============================================ */
.upload-section {
    margin-bottom: 30px;
}

.upload-container {
    position: relative;
    background: var(--bg-secondary);
    border: 2px dashed var(--secondary-color);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.upload-container:hover {
    background-color: #f0f9fc;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.upload-container.dragover {
    background-color: #ecf0ff;
    border-color: var(--primary-color);
}

.file-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    color: var(--primary-color);
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
}

.file-label svg {
    width: 32px;
    height: 32px;
}

.file-input {
    display: none;
}

.file-info {
    display: block;
    margin-top: 10px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.file-info.success {
    color: var(--success-color);
    font-weight: 600;
}

/* ============================================
   FILTERS SECTION
   ============================================ */
.filters-section {
    background: var(--bg-secondary);
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-sm);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.filter-icon {
    font-size: 1.2rem;
}

.filter-select {
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--text-primary);
    background-color: white;
    cursor: pointer;
    transition: var(--transition);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%231e40af' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 35px;
}

.filter-select:hover {
    border-color: var(--secondary-color);
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.filter-select option {
    padding: 10px;
    color: var(--text-primary);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-reset {
    padding: 10px 20px;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    width: 100%;
    font-size: 0.95rem;
}

.btn-reset:hover {
    background-color: #06a8c2;
    box-shadow: var(--shadow-md);
}

.btn-reset:active {
    transform: scale(0.98);
}

/* ============================================
   SUMMARY
   ============================================ */
.summary {
    display: flex;
    gap: 30px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.summary-item {
    padding: 12px 20px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    box-shadow: var(--shadow-sm);
    font-size: 0.95rem;
}

.summary-item strong {
    color: var(--primary-color);
    font-weight: 700;
}

/* ============================================
   TABLE SECTION
   ============================================ */
.table-wrapper {
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    margin-bottom: 30px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--primary-color);
    color: white;
    position: sticky;
    top: 0;
}

.data-table th {
    padding: 16px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background-color: var(--bg-color);
}

.data-table tbody tr.empty-state {
    background-color: var(--bg-color);
}

.data-table td {
    padding: 14px 12px;
    font-size: 0.9rem;
    vertical-align: middle;
}

.data-table tbody tr:last-child {
    border-bottom: none;
}

.empty-state td {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px 12px;
    font-style: italic;
}

/* Status Badge Styles */
.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-concluida {
    background-color: #d1fae5;
    color: #065f46;
}

.status-descarga-iniciada {
    background-color: #fef08a;
    color: #713f12;
}

.status-docada {
    background-color: #dbeafe;
    color: #0c2240;
}

.status-fos {
    background-color: #f3e8ff;
    color: #5b21b6;
}

.status-nao-chegou {
    background-color: #fee2e2;
    color: #7f1d1d;
}

.status-aguardando-doca {
    background-color: #fef3c7;
    color: #78350f;
}

.status-bloqueada {
    background-color: #fecaca;
    color: #7f1d1d;
}

/* ============================================
   LOADING INDICATOR
   ============================================ */
.loading-indicator {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    z-index: 1000;
}

.loading-indicator.active {
    display: block;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-indicator p {
    color: var(--text-secondary);
    font-weight: 500;
}

/* ============================================
   OVERLAY
   ============================================ */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 999;
}

.overlay.active {
    display: block;
}

/* ============================================
   RESPONSIVE DESIGN - TABLET
   ============================================ */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .header {
        padding: 30px 20px;
    }

    .header h1 {
        font-size: 1.8rem;
    }

    .header .subtitle {
        font-size: 0.95rem;
    }

    .filters-section {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .upload-container {
        padding: 30px 15px;
    }

    .file-label {
        font-size: 0.95rem;
    }

    .summary {
        flex-direction: column;
        gap: 10px;
    }

    .summary-item {
        width: 100%;
    }

    .data-table {
        font-size: 0.85rem;
    }

    .data-table th,
    .data-table td {
        padding: 10px 8px;
    }

    .filter-select {
        font-size: 0.9rem;
        padding: 8px 10px;
        padding-right: 32px;
    }
}

/* ============================================
   RESPONSIVE DESIGN - MOBILE
   ============================================ */
@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    .header {
        padding: 25px 15px;
        margin-bottom: 20px;
    }

    .header h1 {
        font-size: 1.4rem;
    }

    .header .subtitle {
        font-size: 0.85rem;
    }

    .filters-section {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 15px;
    }

    .filter-group {
        width: 100%;
    }

    .btn-reset {
        grid-column: 1 / -1;
    }

    .upload-container {
        padding: 25px 12px;
        border-radius: 8px;
    }

    .file-label {
        font-size: 0.85rem;
        gap: 10px;
    }

    .file-label svg {
        width: 24px;
        height: 24px;
    }

    .summary {
        flex-direction: column;
        gap: 8px;
        margin-bottom: 20px;
    }

    .summary-item {
        padding: 10px 15px;
        font-size: 0.85rem;
        border-left-width: 3px;
    }

    .table-wrapper {
        border-radius: 8px;
        margin-bottom: 20px;
        overflow-x: auto;
    }

    .data-table {
        min-width: 600px;
        font-size: 0.75rem;
    }

    .data-table th {
        padding: 8px 6px;
        font-size: 0.75rem;
    }

    .data-table td {
        padding: 8px 6px;
        font-size: 0.75rem;
    }

    .status-badge {
        padding: 4px 8px;
        font-size: 0.7rem;
    }

    .filter-select {
        font-size: 0.85rem;
        padding: 8px 10px;
        padding-right: 28px;
    }

    .filter-select option {
        padding: 8px;
        font-size: 0.85rem;
    }
}

/* ============================================
   ACESSIBILIDADE
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus Visível para Acessibilidade */
button:focus-visible,
select:focus-visible,
input:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}
