/* ═══════════════════════════════════════════
   Midas Company — Painel do Cliente
   Brand: #004C3F (verde), #FFC994 (dourado)
   ═══════════════════════════════════════════ */

:root {
    /* Brand palette */
    --verde:        #004C3F;
    --verde-claro:  #00726A;
    --verde-light:  #e6f0ee;
    --verde-bg:     #f0f7f5;
    --dourado:      #FFC994;
    --dourado-dark: #C08052;
    --cobre:        #C08052;

    /* Neutrals */
    --bg:           #fafbfc;
    --surface:      #ffffff;
    --border:       #e8ebe9;
    --text:         #1B1E1E;
    --text-muted:   #5a6360;
    --text-light:   #8a9490;

    /* Status colors */
    --status-pendente:    #f59e0b;
    --status-pendente-bg: #fef3c7;
    --status-andamento:   #3b82f6;
    --status-andamento-bg:#dbeafe;
    --status-concluido:   #10b981;
    --status-concluido-bg:#d1fae5;
    --status-aguardando:  #8b5cf6;
    --status-aguardando-bg:#ede9fe;

    /* Typography */
    --font-display: 'DM Serif Display', Georgia, serif;
    --font-body:    'DM Sans', -apple-system, sans-serif;

    /* Spacing */
    --container: 1200px;
    --gutter: 24px;
    --radius: 12px;
    --radius-sm: 8px;
}

/* ─── Reset & Base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

/* ─── Loading Overlay ─── */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--verde);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-overlay.fade-out {
    opacity: 0;
    visibility: hidden;
}

.loading-content {
    text-align: center;
}

.loading-logo {
    width: 180px;
    margin-bottom: 40px;
    filter: brightness(0) invert(1);
    animation: pulse-logo 2s ease-in-out infinite;
}

@keyframes pulse-logo {
    0%, 100% { opacity: 0.7; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.03); }
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255,255,255,0.15);
    border-top-color: var(--dourado);
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: spin 0.8s linear infinite;
}

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

.loading-text {
    font-family: var(--font-body);
    color: rgba(255,255,255,0.6);
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.05em;
}

/* ─── Error State ─── */
.error-state {
    position: fixed;
    inset: 0;
    background: var(--verde);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.error-content {
    text-align: center;
    max-width: 400px;
    padding: 24px;
}

.error-logo {
    width: 160px;
    margin-bottom: 40px;
    filter: brightness(0) invert(1);
}

.error-content h2 {
    font-family: var(--font-display);
    color: var(--dourado);
    font-size: 1.75rem;
    margin-bottom: 12px;
}

.error-content p {
    color: rgba(255,255,255,0.6);
    font-size: 0.95rem;
    margin-bottom: 32px;
    line-height: 1.6;
}

.error-link {
    display: inline-block;
    color: var(--dourado);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    border: 1px solid rgba(255,201,148,0.3);
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.error-link:hover {
    background: rgba(255,201,148,0.1);
    border-color: var(--dourado);
}

/* ─── Dashboard Layout ─── */
.dashboard {
    min-height: 100vh;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ─── Header ─── */
.header {
    background: var(--verde);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 20px rgba(0,76,63,0.15);
}

.header-inner {
    max-width: var(--container);
    margin: 0 auto;
    padding: 16px var(--gutter);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-logo {
    height: 32px;
    filter: brightness(0) invert(1);
}

.header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.header-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--dourado);
    text-transform: uppercase;
}

.header-company {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: #ffffff;
}

/* ─── Stats Section ─── */
.stats-section {
    max-width: var(--container);
    margin: 0 auto;
    padding: var(--gutter) var(--gutter) 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
}

.stat-number {
    font-family: var(--font-display);
    font-size: 2.25rem;
    line-height: 1;
    margin-bottom: 6px;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.stat-total .stat-number { color: var(--verde); }
.stat-andamento .stat-number { color: var(--status-andamento); }
.stat-pendente .stat-number { color: var(--status-pendente); }
.stat-concluido .stat-number { color: var(--status-concluido); }
.stat-aguardando .stat-number { color: var(--status-aguardando); }

/* ─── Progress Section ─── */
.progress-section {
    max-width: var(--container);
    margin: 0 auto;
    padding: 20px var(--gutter) 0;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.progress-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.progress-percent {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--verde);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--verde-light);
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--verde), var(--verde-claro));
    border-radius: 999px;
    transition: width 1s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ─── Filters Section ─── */
.filters-section {
    max-width: var(--container);
    margin: 0 auto;
    padding: 20px var(--gutter) 0;
}

.filters-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 180px;
}

.filter-group label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.filter-group select {
    font-family: var(--font-body);
    font-size: 0.875rem;
    padding: 8px 32px 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%235a6360'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: border-color 0.2s;
}

.filter-group select:hover,
.filter-group select:focus {
    border-color: var(--verde-claro);
    outline: none;
}

/* ─── Table Section ─── */
.table-section {
    max-width: var(--container);
    margin: 0 auto;
    padding: 20px var(--gutter);
}

.table-wrapper {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    overflow-x: auto;
}

.tasks-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.tasks-table thead {
    background: var(--verde);
}

.tasks-table th {
    padding: 14px 16px;
    text-align: left;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.9);
    white-space: nowrap;
}

.tasks-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.tasks-table tbody tr {
    transition: background 0.15s;
}

.tasks-table tbody tr:hover {
    background: var(--verde-bg);
}

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

/* Task name */
.task-name {
    font-weight: 600;
    color: var(--text);
    max-width: 320px;
}

/* Project badge */
.project-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--verde-light);
    color: var(--verde);
    white-space: nowrap;
}

/* Status badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 999px;
    white-space: nowrap;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-pendente {
    background: var(--status-pendente-bg);
    color: #92400e;
}
.status-pendente::before { background: var(--status-pendente); }

.status-em-andamento {
    background: var(--status-andamento-bg);
    color: #1e40af;
}
.status-em-andamento::before { background: var(--status-andamento); }

.status-concluido {
    background: var(--status-concluido-bg);
    color: #065f46;
}
.status-concluido::before { background: var(--status-concluido); }

.status-aguardando-cliente {
    background: var(--status-aguardando-bg);
    color: #5b21b6;
}
.status-aguardando-cliente::before { background: var(--status-aguardando); }

/* Responsavel */
.responsavel {
    font-weight: 500;
    color: var(--text-muted);
}

/* Date */
.date-cell {
    white-space: nowrap;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.date-cell.overdue {
    color: #dc2626;
    font-weight: 600;
}

.date-cell.due-soon {
    color: var(--status-pendente);
    font-weight: 600;
}

/* Empty state */
.table-empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-light);
}

.table-empty p {
    font-size: 0.95rem;
}

/* ─── Footer ─── */
.footer {
    max-width: var(--container);
    margin: 0 auto;
    padding: 16px var(--gutter) 32px;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-light);
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* ─── Responsive ─── */
@media (max-width: 900px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 640px) {
    :root {
        --gutter: 16px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-card {
        padding: 14px;
    }

    .stat-number {
        font-size: 1.75rem;
    }

    .header-inner {
        padding: 12px var(--gutter);
    }

    .header-logo {
        height: 26px;
    }

    .header-company {
        font-size: 0.95rem;
    }

    .filters-row {
        flex-direction: column;
        gap: 12px;
    }

    .filter-group {
        min-width: 100%;
    }

    .tasks-table {
        font-size: 0.8rem;
    }

    .tasks-table th,
    .tasks-table td {
        padding: 10px 12px;
    }

    .task-name {
        max-width: 200px;
    }

    .footer-inner {
        flex-direction: column;
        gap: 4px;
        text-align: center;
    }
}

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

    .stat-card:last-child {
        grid-column: span 2;
    }
}
