/* ============================================================
   Águia Representações — CSS Global
   Paleta: Vermelho (#C0392B / #E74C3C) + Branco + Cinza
   ============================================================ */

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

:root {
    --red-dark:    #8B1A1A;
    --red-main:    #C0392B;
    --red-light:   #E74C3C;
    --red-pale:    #FDEDEC;
    --red-border:  #F1948A;

    --gray-50:     #F9FAFB;
    --gray-100:    #F3F4F6;
    --gray-200:    #E5E7EB;
    --gray-300:    #D1D5DB;
    --gray-400:    #9CA3AF;
    --gray-500:    #6B7280;
    --gray-600:    #4B5563;
    --gray-700:    #374151;
    --gray-800:    #1F2937;
    --gray-900:    #111827;

    --white:       #FFFFFF;
    --success:     #27AE60;
    --warning:     #F39C12;
    --danger:      #C0392B;
    --info:        #2980B9;

    --shadow-sm:   0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md:   0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
    --shadow-lg:   0 10px 15px rgba(0,0,0,.10), 0 4px 6px rgba(0,0,0,.05);
    --shadow-xl:   0 20px 25px rgba(0,0,0,.12), 0 10px 10px rgba(0,0,0,.04);

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

    --font-sans:   'Segoe UI', system-ui, -apple-system, sans-serif;
    --transition:  .2s ease;
}

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

body {
    font-family: var(--font-sans);
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--red-main); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--red-dark); }

img { max-width: 100%; display: block; }

/* --- Tipografia -------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    color: var(--gray-900);
}
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

.text-muted   { color: var(--gray-500); }
.text-center  { text-align: center; }
.text-link    { font-size: .875rem; color: var(--gray-500); }
.text-link:hover { color: var(--red-main); }

/* --- Navbar ------------------------------------------------ */
.navbar {
    background: var(--red-main);
    background: linear-gradient(135deg, var(--red-dark) 0%, var(--red-main) 100%);
    color: var(--white);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: .75rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-shrink: 0;
}

.navbar-logo { font-size: 1.5rem; }

.navbar-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--white);
    white-space: nowrap;
}

.navbar-badge {
    font-size: .65rem;
    font-weight: 700;
    padding: .2rem .5rem;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.badge-admin         { background: var(--white); color: var(--red-main); }
.badge-representante { background: rgba(255,255,255,.25); color: var(--white); border: 1px solid rgba(255,255,255,.4); }
.badge-usuario       { background: rgba(255,255,255,.2); color: var(--white); border: 1px solid rgba(255,255,255,.35); }

.navbar-menu {
    display: flex;
    list-style: none;
    gap: .25rem;
    flex: 1;
}

.navbar-menu a {
    color: rgba(255,255,255,.85);
    padding: .4rem .85rem;
    border-radius: var(--radius-md);
    font-size: .9rem;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
}

.navbar-menu a:hover,
.navbar-menu a.active {
    background: rgba(255,255,255,.18);
    color: var(--white);
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: .75rem;
    font-size: .875rem;
    color: rgba(255,255,255,.9);
    flex-shrink: 0;
}

/* --- Botões ------------------------------------------------ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .5rem 1.1rem;
    border-radius: var(--radius-md);
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
}

.btn:focus { outline: 3px solid rgba(192,57,43,.4); outline-offset: 2px; }

.btn-primary {
    background: var(--red-main);
    color: var(--white);
    border-color: var(--red-main);
}
.btn-primary:hover {
    background: var(--red-dark);
    border-color: var(--red-dark);
    color: var(--white);
}

.btn-secondary {
    background: var(--gray-600);
    color: var(--white);
    border-color: var(--gray-600);
}
.btn-secondary:hover {
    background: var(--gray-700);
    border-color: var(--gray-700);
    color: var(--white);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
    border-color: var(--danger);
}
.btn-danger:hover { background: var(--red-dark); border-color: var(--red-dark); color: var(--white); }

.btn-outline {
    background: transparent;
    color: var(--red-main);
    border-color: var(--red-main);
}
.btn-outline:hover {
    background: var(--red-pale);
    color: var(--red-dark);
}

.btn-outline-sm {
    background: rgba(255,255,255,.15);
    color: var(--white);
    border: 1px solid rgba(255,255,255,.4);
    padding: .3rem .75rem;
    font-size: .8rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition);
    text-decoration: none;
    font-weight: 500;
}
.btn-outline-sm:hover { background: rgba(255,255,255,.25); color: var(--white); }

.btn-sm { padding: .3rem .7rem; font-size: .8rem; }
.btn-block { width: 100%; }

/* --- Formulários ------------------------------------------- */
.form-group { margin-bottom: 1.1rem; }
.form-group label {
    display: block;
    font-size: .875rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: .35rem;
}

.form-control {
    width: 100%;
    padding: .55rem .85rem;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-size: .9rem;
    color: var(--gray-800);
    background: var(--white);
    transition: border-color var(--transition), box-shadow var(--transition);
    font-family: var(--font-sans);
}

.form-control:focus {
    outline: none;
    border-color: var(--red-main);
    box-shadow: 0 0 0 3px rgba(192,57,43,.12);
}

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

.form-hint {
    font-size: .78rem;
    color: var(--gray-500);
    margin-top: .3rem;
    display: block;
}

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

.form-actions {
    display: flex;
    gap: .75rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

.file-current {
    display: flex;
    align-items: center;
    gap: .75rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: .5rem .85rem;
    margin-bottom: .5rem;
    font-size: .875rem;
}

/* --- Cards ------------------------------------------------- */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

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

.card-header h3 { font-size: 1rem; color: var(--gray-800); margin: 0; }

.card-body { padding: 1.5rem; }

/* --- Tabelas ----------------------------------------------- */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}

.table th {
    background: var(--gray-50);
    color: var(--gray-600);
    font-weight: 600;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: .75rem 1rem;
    border-bottom: 2px solid var(--gray-200);
    text-align: left;
    white-space: nowrap;
}

.table td {
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
    vertical-align: middle;
}

.table tbody tr:hover { background: var(--gray-50); }
.table tbody tr:last-child td { border-bottom: none; }

.actions { display: flex; gap: .4rem; flex-wrap: wrap; }

/* --- Badges ------------------------------------------------ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: .2rem .6rem;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.badge-success     { background: #D5F5E3; color: #1E8449; }
.badge-danger      { background: #FADBD8; color: #922B21; }
.badge-admin       { background: var(--red-pale); color: var(--red-dark); }
.badge-representante { background: #EBF5FB; color: #1A5276; }
.badge-usuario     { background: #F4ECF7; color: #6C3483; }
.badge-tipo-geral  { background: var(--gray-100); color: var(--gray-600); }
.badge-tipo-categoria { background: #FEF9E7; color: #7D6608; }
.badge-categoria   { background: #FEF9E7; color: #7D6608; }
.badge-geral       { background: var(--gray-100); color: var(--gray-600); }

/* --- Alertas ----------------------------------------------- */
.alert {
    padding: .85rem 1.1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    font-size: .9rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
    border-left: 4px solid;
}

.alert-success { background: #D5F5E3; color: #1E8449; border-color: #27AE60; }
.alert-danger  { background: #FADBD8; color: #922B21; border-color: var(--red-main); }
.alert-warning { background: #FEF9E7; color: #7D6608; border-color: var(--warning); }
.alert-info    { background: #EBF5FB; color: #1A5276; border-color: var(--info); }

.alert-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: inherit;
    opacity: .7;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
}
.alert-close:hover { opacity: 1; }

/* --- Layout Principal -------------------------------------- */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.page-header h2 { font-size: 1.6rem; color: var(--gray-900); }
.page-subtitle { color: var(--gray-500); font-weight: 400; font-size: 1rem; }

/* --- Stats Grid -------------------------------------------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    gap: .75rem;
    transition: box-shadow var(--transition), transform var(--transition);
}

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

.stat-icon { font-size: 2rem; }

.stat-info {
    display: flex;
    flex-direction: column;
    gap: .15rem;
}

.stat-number {
    font-size: 2rem;
    font-weight: 800;
    color: var(--red-main);
    line-height: 1;
}

.stat-label {
    font-size: .8rem;
    color: var(--gray-500);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.stat-link {
    font-size: .8rem;
    color: var(--red-main);
    font-weight: 600;
    margin-top: auto;
}

/* --- Quick Actions ----------------------------------------- */
.quick-actions { margin-bottom: 2rem; }
.quick-actions h3 { margin-bottom: 1rem; color: var(--gray-700); }

.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}

.action-card {
    background: var(--white);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
    text-align: center;
    color: var(--gray-700);
    font-size: .875rem;
    font-weight: 600;
    transition: all var(--transition);
    cursor: pointer;
}

.action-card:hover {
    border-color: var(--red-main);
    background: var(--red-pale);
    color: var(--red-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.action-icon { font-size: 1.75rem; }

/* --- Login Page -------------------------------------------- */
.login-page {
    background: linear-gradient(135deg, var(--red-dark) 0%, var(--red-main) 50%, var(--red-light) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 1.5rem;
    margin: auto;
}

.login-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    box-shadow: var(--shadow-xl);
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-eagle { font-size: 3rem; display: block; margin-bottom: .5rem; }

.login-logo h1 {
    font-size: 1.4rem;
    color: var(--red-dark);
    margin-bottom: .25rem;
}

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

.login-form { margin-bottom: 1.5rem; }

.login-links {
    text-align: center;
    font-size: .8rem;
    color: var(--gray-500);
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

/* --- Busca ------------------------------------------------- */
.search-bar-container {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.search-form { width: 100%; }

.search-row {
    display: flex;
    gap: .75rem;
    align-items: center;
    flex-wrap: wrap;
}

.search-input-wrap { flex: 1; min-width: 200px; }
.search-filter-wrap { min-width: 200px; }

.search-input { font-size: .95rem; }

.search-results-info {
    font-size: .875rem;
    color: var(--gray-600);
    margin-bottom: 1.25rem;
}

/* --- Importadoras / Catálogos ------------------------------ */
.importadora-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    margin-bottom: 1.75rem;
    overflow: hidden;
}

.importadora-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, var(--red-dark) 0%, var(--red-main) 100%);
    color: var(--white);
    flex-wrap: wrap;
    gap: .75rem;
}

.importadora-title h3 {
    color: var(--white);
    font-size: 1.1rem;
    margin: 0;
}

.catalogos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.25rem;
    padding: 1.5rem;
}

.catalogo-card {
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all var(--transition);
    background: var(--white);
}

.catalogo-card:hover {
    border-color: var(--red-border);
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

.catalogo-card-header {
    padding: .6rem .85rem;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.catalogo-badge {
    font-size: .72rem;
    font-weight: 700;
    padding: .2rem .55rem;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.catalogo-card-body {
    flex: 1;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: .75rem;
}

.catalogo-icon { font-size: 2.5rem; }

.catalogo-nome {
    font-size: .9rem;
    color: var(--gray-800);
    font-weight: 600;
    line-height: 1.4;
}

.catalogo-card-footer {
    padding: .85rem;
    border-top: 1px solid var(--gray-100);
}

/* --- Empty State ------------------------------------------- */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
}

.empty-icon { font-size: 3.5rem; margin-bottom: 1rem; }
.empty-state h3 { color: var(--gray-700); margin-bottom: .5rem; }
.empty-state p  { color: var(--gray-500); font-size: .9rem; }

/* --- Coming Soon ------------------------------------------- */
.coming-soon-card { border: 2px dashed var(--gray-300); background: var(--gray-50); }

.coming-soon {
    text-align: center;
    padding: 2rem;
}

.coming-soon-icon { font-size: 3rem; margin-bottom: 1rem; }
.coming-soon h3   { color: var(--gray-700); margin-bottom: .5rem; }
.coming-soon p    { color: var(--gray-500); font-size: .9rem; margin-bottom: 1rem; }

.coming-soon-list {
    list-style: none;
    display: inline-flex;
    flex-direction: column;
    gap: .4rem;
    text-align: left;
}

.coming-soon-list li {
    font-size: .875rem;
    color: var(--gray-600);
}

/* --- Modal ------------------------------------------------- */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.6);
    backdrop-filter: blur(3px);
}

.modal-content {
    position: relative;
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    max-height: 95vh;
    width: 100%;
    animation: modalIn .25s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(.95) translateY(-10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-pdf {
    max-width: 900px;
    height: 90vh;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    background: linear-gradient(135deg, var(--red-dark) 0%, var(--red-main) 100%);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.modal-header h4 {
    color: var(--white);
    font-size: 1rem;
    margin: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modal-close {
    background: rgba(255,255,255,.2);
    border: none;
    color: var(--white);
    font-size: 1.3rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
    flex-shrink: 0;
    line-height: 1;
}
.modal-close:hover { background: rgba(255,255,255,.35); }

.modal-body {
    flex: 1;
    overflow: hidden;
    padding: 0;
}

.modal-body iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: .75rem;
    padding: .85rem 1.25rem;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* --- Footer ------------------------------------------------ */
.site-footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--gray-400);
    font-size: .8rem;
    border-top: 1px solid var(--gray-200);
    margin-top: 2rem;
    background: var(--white);
}

/* --- Responsividade ---------------------------------------- */
@media (max-width: 768px) {
    .navbar {
        flex-wrap: wrap;
        gap: .5rem;
        padding: .6rem 1rem;
    }

    .navbar-menu {
        order: 3;
        width: 100%;
        overflow-x: auto;
        flex-wrap: nowrap;
    }

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

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

    .search-row { flex-direction: column; }
    .search-input-wrap,
    .search-filter-wrap { width: 100%; }

    .catalogos-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

    .modal-pdf { height: 85vh; }

    .page-header { flex-direction: column; align-items: flex-start; }

    .main-content { padding: 1rem; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .action-grid { grid-template-columns: repeat(2, 1fr); }
    .login-card { padding: 1.75rem 1.25rem; }
}
