/* ===================================
   Plataforma Ofícios — Design System
   CNJ — Conselho Nacional de Juventude
   =================================== */

@font-face {
    font-family: 'Mic 32 New Rounded W00';
    src: url('../fonts/mic32-new-regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Mic 32 New Rounded W00';
    src: url('../fonts/mic32-rounded-medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@import url('https://fonts.googleapis.com/css2?family=Nunito+Sans:wght@300;400;500;600;700;800&display=swap');

/* === CSS Variables === */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f7f7f8;
    --bg-card: #ffffff;
    --bg-card-hover: #fafafa;
    --bg-glass: rgba(0, 0, 0, 0.02);
    --border-color: #e5e5e8;
    --border-light: #f0f0f2;

    --text-primary: #1f6676;
    --text-secondary: #5a7a8a;
    --text-muted: #8a9aaa;

    --gold: #23788a;
    --gold-dark: #1a5d6b;
    --gold-light: #3096ab;
    --accent-green: #2d9d6a;
    --accent-red: #d94f4f;
    --accent-orange: #d4883a;

    --gradient-gold: linear-gradient(135deg, #23788a 0%, #3096ab 50%, #1a5d6b 100%);
    --gradient-dark: linear-gradient(135deg, #1f6676 0%, #2a5a6a 100%);
    --gradient-success: linear-gradient(135deg, #2d9d6a 0%, #3ab87d 100%);
    --gradient-danger: linear-gradient(135deg, #d94f4f 0%, #e06a6a 100%);

    --shadow-sm: 0 1px 4px rgba(31, 102, 118, 0.06);
    --shadow-md: 0 4px 12px rgba(31, 102, 118, 0.08);
    --shadow-lg: 0 8px 24px rgba(31, 102, 118, 0.10);
    --shadow-gold: 0 4px 16px rgba(35, 120, 138, 0.25);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    --font-main: 'Arial', sans-serif;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    background: var(--bg-secondary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === Container === */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
}

/* === Header === */
.header {
    padding: 40px 0 8px 0;
    text-align: center;
    margin-bottom: 8px;
}

.header h1 {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
    letter-spacing: -0.5px;
}

.header .subtitle {
    font-size: 1rem;
    font-weight: 500;
    color: var(--gold);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.header p {
    color: var(--text-muted);
    font-size: 0.92rem;
    font-weight: 400;
}

/* === Navigation Tabs === */
.nav-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 32px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 5px;
    box-shadow: var(--shadow-sm);
}

.nav-tab {
    flex: 1;
    text-align: center;
    padding: 11px 20px;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.92rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.nav-tab:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.nav-tab.active {
    background: var(--gradient-dark);
    color: #ffffff;
    box-shadow: var(--shadow-md);
}

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

/* === Cards === */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 24px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

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

.card-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header .icon {
    font-size: 1.3rem;
}

/* === Upload Area === */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 48px 32px;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    background: var(--bg-secondary);
}

.upload-area:hover {
    border-color: var(--gold);
    background: rgba(197, 165, 90, 0.04);
    transform: translateY(-2px);
}

.upload-area.drag-over {
    border-color: var(--gold);
    background: rgba(197, 165, 90, 0.08);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    display: block;
}

.upload-area h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.upload-area p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

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

.file-name {
    margin-top: 12px;
    padding: 8px 16px;
    background: rgba(197, 165, 90, 0.1);
    border-radius: var(--radius-sm);
    display: inline-block;
    color: var(--gold-dark);
    font-weight: 600;
    font-size: 0.9rem;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-main);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--gradient-dark);
    color: #ffffff;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--gradient-gold);
    color: #1a1a1a;
    box-shadow: var(--shadow-sm);
}

.btn-success:hover {
    box-shadow: var(--shadow-gold);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--gradient-danger);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.btn-danger:hover {
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-outline:hover {
    border-color: var(--gold);
    color: var(--gold-dark);
    background: rgba(197, 165, 90, 0.04);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.82rem;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 1rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-sm);
}

/* === Table === */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

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

.table thead {
    background: var(--bg-secondary);
}

.table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background: rgba(197, 165, 90, 0.03);
}

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

.table .actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* === Status Badges === */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.badge-success {
    background: rgba(45, 157, 106, 0.1);
    color: var(--accent-green);
}

.badge-warning {
    background: rgba(197, 165, 90, 0.12);
    color: var(--gold-dark);
}

.badge-info {
    background: rgba(26, 26, 26, 0.06);
    color: var(--text-secondary);
}

.badge-pending {
    background: rgba(154, 154, 170, 0.1);
    color: var(--text-muted);
}

/* === Alerts / Messages === */
.alert {
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.92rem;
    font-weight: 500;
    animation: slideDown 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.alert-success {
    background: rgba(45, 157, 106, 0.08);
    border: 1px solid rgba(45, 157, 106, 0.2);
    color: var(--accent-green);
}

.alert-error {
    background: rgba(217, 79, 79, 0.08);
    border: 1px solid rgba(217, 79, 79, 0.2);
    color: var(--accent-red);
}

.alert-info {
    background: rgba(197, 165, 90, 0.08);
    border: 1px solid rgba(197, 165, 90, 0.2);
    color: var(--gold-dark);
}

/* === Email Preview === */
.email-preview {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    margin: 20px 0;
}

.email-preview .email-field {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}

.email-preview .email-field:last-of-type {
    margin-bottom: 20px;
}

.email-preview .email-label {
    font-weight: 700;
    color: var(--text-secondary);
    min-width: 80px;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.email-preview .email-value {
    color: var(--text-primary);
}

.email-preview .email-body {
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    line-height: 1.8;
    white-space: pre-line;
    color: var(--text-primary);
}

.pdf-preview {
    margin: 20px 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.pdf-preview iframe {
    width: 100%;
    height: 500px;
    border: none;
}

.pdf-preview-header {
    padding: 12px 16px;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

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

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: center;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

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

.stat-number {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-primary);
}

.stat-card:nth-child(2) .stat-number {
    color: var(--gold);
}

.stat-card:nth-child(3) .stat-number {
    color: var(--accent-green);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* === Form Actions === */
.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

/* === Empty State === */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state .icon {
    font-size: 3.5rem;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state h3 {
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.empty-state p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

/* === Loading Spinner === */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* === Animations === */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* === Gold accent line under header === */
.header::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: var(--gradient-gold);
    margin: 12px auto 0 auto;
    border-radius: 2px;
}

/* === Tooltip === */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    background: var(--text-primary);
    color: #fff;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.tooltip:hover::after {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

/* === Responsive === */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.7rem;
    }

    .nav-tabs {
        flex-direction: column;
    }

    .card {
        padding: 20px;
    }

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

    .form-actions {
        flex-direction: column;
    }

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

    .btn-lg {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }

    .header h1 {
        font-size: 1.4rem;
    }

    .upload-area {
        padding: 32px 16px;
    }
}