/*
 * Otimizador de Imagens v2.0
 * Multi-Page Premium Design System
 */

/* ===== DESIGN TOKENS ===== */
:root {
    /* Primary: Deep Teal */
    --primary-50: #f0fdfa;
    --primary-100: #ccfbf1;
    --primary-200: #99f6e4;
    --primary-400: #2dd4bf;
    --primary-500: #14b8a6;
    --primary-600: #0d9488;
    --primary-700: #0f766e;
    --primary-800: #115e59;

    /* Neutrals */
    --gray-25: #fcfcfc;
    --gray-50: #fafaf9;
    --gray-100: #f5f5f4;
    --gray-200: #e7e5e4;
    --gray-300: #d6d3d1;
    --gray-400: #a8a29e;
    --gray-500: #78716c;
    --gray-600: #57534e;
    --gray-700: #44403c;
    --gray-800: #292524;
    --gray-900: #1c1917;

    /* Semantic */
    --success: #059669;
    --success-bg: #ecfdf5;
    --error: #dc2626;
    --error-bg: #fef2f2;
    --warning: #d97706;
    --warning-bg: #fffbeb;
    --info: #0284c7;
    --info-bg: #f0f9ff;

    /* Layout */
    --sidebar-width: 240px;
    --header-height: 72px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08);

    /* Misc */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ===== RESET ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.5;
}

/* ===== APP LAYOUT ===== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--gray-900);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.brand-info {
    display: flex;
    flex-direction: column;
}

.brand-name {
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.brand-sub {
    font-size: 0.7rem;
    color: var(--gray-400);
    font-weight: 500;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--gray-400);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

.nav-item:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.nav-icon {
    font-size: 1.1rem;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.version {
    font-size: 0.7rem;
    color: var(--gray-500);
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 32px;
    background: white;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 50;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.02em;
}

.page-subtitle {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-top: 2px;
}

.page-content {
    flex: 1;
    padding: 32px;
}

/* ===== CARDS ===== */
.card {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-100);
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
}

.card-body {
    padding: 24px;
}

/* ===== STATS GRID ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--gray-200);
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-icon.teal {
    background: var(--primary-100);
}

.stat-icon.green {
    background: var(--success-bg);
}

.stat-icon.amber {
    background: var(--warning-bg);
}

.stat-icon.blue {
    background: var(--info-bg);
}

.stat-info {
    flex: 1;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--gray-500);
    font-weight: 500;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--gray-800);
    transform: translateY(-1px);
}

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

.btn-success:hover {
    filter: brightness(1.1);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
}

.btn-secondary:hover {
    background: var(--gray-200);
}

.btn-lg {
    height: 52px;
    padding: 0 28px;
    font-size: 1rem;
}

/* ===== FORMS ===== */
.form-grid {
    display: grid;
    gap: 24px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    display: flex;
    align-items: center;
    gap: 6px;
}

.form-label .required {
    color: var(--error);
}

.form-hint {
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-left: auto;
}

.form-input,
.form-select {
    height: 48px;
    padding: 0 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    font-family: inherit;
    color: var(--gray-800);
    background: white;
    transition: all 0.15s ease;
    width: 100%;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px var(--primary-100);
}

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2378716c' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 44px;
}

/* ===== UPLOAD ZONE ===== */
.upload-zone {
    position: relative;
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-xl);
    padding: 48px 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--gray-50);
}

.upload-zone:hover {
    border-color: var(--primary-500);
    background: var(--primary-50);
}

.upload-zone.dragover {
    border-color: var(--primary-500);
    background: var(--primary-100);
    transform: scale(1.01);
}

.upload-zone.has-files {
    border-style: solid;
    border-color: var(--success);
    background: var(--success-bg);
}

.upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    background: var(--gray-100);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    transition: all 0.2s ease;
}

.upload-zone:hover .upload-icon {
    background: var(--primary-100);
    transform: scale(1.1);
}

.upload-zone.has-files .upload-icon {
    background: var(--success);
}

.upload-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 4px;
}

.upload-subtitle {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.upload-formats {
    display: inline-flex;
    gap: 8px;
    margin-top: 16px;
}

.format-badge {
    padding: 4px 10px;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
}

/* ===== FILE LIST ===== */
.file-list {
    margin-top: 20px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
}

.file-item-icon {
    width: 36px;
    height: 36px;
    background: var(--primary-100);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-item-info {
    flex: 1;
    min-width: 0;
}

.file-item-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-item-size {
    font-size: 0.75rem;
    color: var(--gray-400);
}

.file-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--primary-700);
    border-radius: var(--radius-md);
    margin-top: 12px;
    color: white;
}

.file-summary-text {
    font-size: 0.875rem;
    font-weight: 600;
}

/* ===== TABLES ===== */
.table-wrapper {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

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

.data-table th,
.data-table td {
    padding: 14px 20px;
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
}

.data-table th {
    background: var(--gray-50);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table tbody tr:hover {
    background: var(--gray-50);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* ===== STATUS BADGES ===== */
.status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-success {
    background: var(--success-bg);
    color: var(--success);
}

.status-error {
    background: var(--error-bg);
    color: var(--error);
}

.status-pending {
    background: var(--warning-bg);
    color: var(--warning);
}

/* ===== ALERTS ===== */
.alert {
    display: none;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 0.875rem;
    align-items: center;
    gap: 12px;
}

.alert.visible {
    display: flex;
}

.alert-error {
    background: var(--error-bg);
    color: var(--error);
    border: 1px solid rgba(220, 38, 38, 0.2);
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(5, 150, 105, 0.2);
}

/* ===== PROGRESS ===== */
.progress-section {
    display: none;
    padding: 24px;
    background: var(--gray-50);
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    margin-bottom: 24px;
}

.progress-section.visible {
    display: block;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

.progress-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
}

.progress-value {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--primary-600);
}

.progress-bar {
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-500), var(--primary-600));
    border-radius: 4px;
    width: 0%;
    transition: width 0.2s ease;
}

.progress-status {
    text-align: center;
    margin-top: 12px;
    font-size: 0.8rem;
    color: var(--gray-500);
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 64px 32px;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.empty-text {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 24px;
}

/* ===== RECENT LIST ===== */
.recent-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--gray-100);
}

.recent-item:last-child {
    border-bottom: none;
}

.recent-icon {
    width: 44px;
    height: 44px;
    background: var(--primary-100);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.recent-info {
    flex: 1;
}

.recent-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-800);
}

.recent-meta {
    font-size: 0.75rem;
    color: var(--gray-400);
}

.recent-action {
    color: var(--primary-600);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
}

.recent-action:hover {
    text-decoration: underline;
}

/* ===== SPINNER ===== */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .sidebar {
        width: 72px;
    }

    .sidebar-header {
        padding: 16px;
        justify-content: center;
    }

    .brand-info,
    .nav-label,
    .sidebar-footer {
        display: none;
    }

    .sidebar-nav {
        padding: 12px 8px;
    }

    .nav-item {
        padding: 12px;
        justify-content: center;
    }

    .nav-icon {
        font-size: 1.25rem;
    }

    .main-content {
        margin-left: 72px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .sidebar {
        display: none;
    }

    .main-content {
        margin-left: 0;
    }

    .page-header {
        padding: 16px 20px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .page-content {
        padding: 20px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}