/* 
   ============================================
   ADMIN PANEL - PREMIUM MODERN THEME (Slate)
   ============================================ */

:root {
    --sidebar-bg: #0f172a; /* Slate 900 */
    --sidebar-hover: #1e293b; /* Slate 800 */
    --sidebar-border: rgba(255,255,255,0.06);
    --topbar-bg: rgba(255, 255, 255, 0.95);
    --accent: #4f46e5; /* Indigo 600 */
    --accent-hover: #4338ca;
    --accent-glow: rgba(79, 70, 229, 0.15);
    --text-muted: #94a3b8;
    --white: #ffffff;
    --sidebar-width: 260px;
    --topbar-height: 68px;
    
    /* Modern Colors */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --success: #10b981;
    --danger: #ef4444;
}

/* === Layout Base === */
.admin-page {
    display: flex;
    min-height: 100vh;
    background: #f1f5f9;
    overflow-x: hidden;
}

/* === Sidebar Moderna === */
.admin-sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: var(--white);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-right: 1px solid var(--sidebar-border);
    box-shadow: 10px 0 30px rgba(0,0,0,0.1);
}

.admin-sidebar-header {
    height: var(--topbar-height);
    background: #ffffff;
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid #e2e8f0;
}

.admin-sidebar-logo img {
    max-height: 38px;
    object-fit: contain;
}

.admin-sidebar-nav {
    flex: 1;
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
}

.admin-sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.admin-sidebar-link:hover {
    background: var(--sidebar-hover);
    color: var(--white);
}

.admin-sidebar-link.active {
    background: var(--accent);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.admin-sidebar-link svg {
    width: 20px;
    height: 20px;
    opacity: 0.8;
}

.admin-sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--sidebar-border);
    background: rgba(0,0,0,0.2);
}

.admin-sidebar-link.danger:hover {
    background: #ef44441a;
    color: #ef4444;
}

/* === Topbar SaaS (Glassmorphism) === */
.admin-topbar {
    position: fixed;
    top: 0;
    right: 0;
    left: var(--sidebar-width);
    height: var(--topbar-height);
    background: var(--topbar-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    z-index: 900;
    transition: left 0.3s ease;
}

.admin-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    padding: 32px;
    transition: margin-left 0.3s ease;
}

/* Reuso de cores originais */
.admin-breadcrumb {
    font-size: 0.85rem;
    font-weight: 500;
    color: #64748b;
}

.admin-breadcrumb span {
    color: #1e293b;
    font-weight: 600;
}

.admin-topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-user-info {
    text-align: right;
}

.admin-user-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.2;
}

.admin-user-role {
    font-size: 0.75rem;
    color: #64748b;
}

.admin-avatar {
    width: 40px;
    height: 40px;
    background: var(--accent);
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.2);
}

/* === Hamburguer Moderno === */
.admin-hamburger {
    display: none;
    cursor: pointer;
    background: #f1f5f9;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    align-items: center;
    justify-content: center;
    margin-right: 16px;
    transition: all 0.2s ease;
}

.admin-hamburger:hover {
    background: #e2e8f0;
}

.admin-hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: #1e293b;
    margin: 4px auto;
    border-radius: 2px;
}

/* === Responsividade Master === */
@media (max-width: 1024px) {
    .admin-sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }

    .admin-sidebar.active {
        transform: translateX(0);
        box-shadow: 20px 0 60px rgba(0,0,0,0.3);
    }

    .admin-topbar, .admin-content {
        left: 0;
        margin-left: 0;
    }

    .admin-hamburger {
        display: flex;
    }
}

@media (max-width: 640px) {
    .admin-topbar { padding: 0 16px; }
    .admin-content { padding: 16px 14px; margin-top: 56px; }
    .hide-mobile { display: none; }
    
    .admin-page-title { font-size: 1.5rem; }
    
    .admin-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 16px;
    }
    
    .admin-card-header .btn {
        width: fit-content;
        min-width: unset;
        padding-left: 20px;
        padding-right: 20px;
        justify-content: center;
        box-sizing: border-box;
    }
    
    .admin-table-wrapper {
        -webkit-overflow-scrolling: touch;
        border-right: 1px solid #e2e8f0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-body {
        padding: 20px;
    }

    /* Grids Responsivos Utility */
    .grid-2-1, .grid-1-2 {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    
    .admin-card-header {
        padding: 16px;
        gap: 12px;
    }

    .admin-card-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

/* Overlay e Login Moderno */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: radial-gradient(circle at top left, #1e293b 0%, #0f172a 100%);
    position: relative;
    overflow: hidden;
}

.login-wrapper::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 50%, rgba(79, 70, 229, 0.15) 0%, transparent 60%);
    animation: rotateMesh 20s linear infinite;
    z-index: 1;
}

@keyframes rotateMesh {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.login-card {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 28px;
    padding: 56px 48px;
    width: 100%;
    max-width: 460px;
    box-shadow: 0 40px 100px -20px rgba(0, 0, 0, 0.6);
    z-index: 10;
    text-align: center;
    position: relative;
}

.login-header { margin-bottom: 40px; }

.login-logo {
    width: 100px;
    height: 100px;
    background: white;
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    box-shadow: 0 12px 24px -6px rgba(0,0,0,0.1);
    padding: 16px;
}

.login-logo img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

.login-title {
    font-size: 2rem;
    font-weight: 800;
    color: #1e293b;
    letter-spacing: -0.03em;
    margin-bottom: 8px;
}

.login-subtitle {
    font-size: 0.95rem;
    color: #64748b;
    font-weight: 500;
}

.login-footer {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid #f1f5f9;
}

.login-footer p {
    font-size: 0.75rem;
    color: #94a3b8;
    line-height: 1.5;
}

.login-card .btn-primary {
    width: 100%;
    height: 52px;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 700;
    margin-top: 16px;
    box-shadow: 0 10px 25px -5px rgba(79, 70, 229, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.login-card .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px -5px rgba(79, 70, 229, 0.5);
}

.admin-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 999;
    display: none;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* === Tipografia e Cabeçalhos === */
.btn {
    width: fit-content;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    width: fit-content;
}

.admin-page-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: 4px;
    letter-spacing: -0.04em;
}

.admin-page-subtitle {
    font-size: 1rem;
    color: var(--gray-500);
    font-weight: 500;
    margin-bottom: 32px;
}

/* === Cards (Container de Conteúdo) === */
.admin-card {
    background: var(--white);
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03), 0 0 1px rgba(0,0,0,0.1);
    border: 1px solid #f1f5f9;
    margin-bottom: 32px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.admin-card:hover {
    box-shadow: 0 12px 30px rgba(0,0,0,0.05), 0 0 1px rgba(0,0,0,0.1);
}

.admin-card-header {
    padding: 24px 32px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    background: #ffffff;
}

.admin-card-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #1e293b;
    letter-spacing: -0.02em;
}

.admin-card-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* === Tabelas Premium === */
.admin-table-wrapper {
    overflow-x: auto;
    padding: 0 8px 8px;
}

.admin-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    text-align: left;
}

.admin-table th, 
.admin-table td {
    padding: 20px 24px;
    border-bottom: 1px solid #f1f5f9;
    color: #475569;
    font-size: 0.925rem;
    transition: background 0.2s ease;
}

.admin-table th {
    background: #f8fafc;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    white-space: nowrap;
}

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

.admin-table tr:hover td {
    background: #f8fafc;
}

.admin-table td:first-child { font-weight: 600; color: #1e293b; }

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

.table-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--gray-500);
    transition: all 0.2s;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.table-btn svg {
    width: 18px;
    height: 18px;
}

.table-btn:hover {
    background: #e2e8f0;
    color: var(--gray-800);
}

.table-btn-edit:hover { color: var(--accent); background: #eef2ff; }
.table-btn-delete:hover { color: #ef4444; background: #fee2e2; }

/* === Badges de Status === */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.status-ativo { background: #dcfce7; color: #166534; }
.status-inativo { background: #fee2e2; color: #991b1b; }

/* === Grid de Estatísticas (Dashboard) === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    border-radius: 12px;
    padding: 24px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.05);
}

.stat-card-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-card-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1;
    margin-bottom: 8px;
}

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

/* === Modal === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    display: none;
    align-items: flex-start;
    justify-content: center;
    z-index: 2000;
    padding: 40px 20px;
    overflow-y: auto;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--white);
    width: 100%;
    max-width: 600px;
    border-radius: 24px;
    box-shadow: 0 50px 100px -20px rgba(0,0,0,0.3);
    max-height: none;
    display: flex;
    flex-direction: column;
    overflow: visible;
    animation: modalIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255,255,255,0.1);
    margin: auto 0;
}

@media (max-width: 640px) {
    .modal {
        max-width: 100% !important;
        margin: 0;
        border-radius: 0;
        height: 100vh;
        max-height: 100vh;
    }
    .modal-header, .modal-body, .modal-footer {
        padding: 20px;
    }
}

@keyframes modalIn {
    from { transform: translateY(40px) scale(0.95); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-header {
    padding: 32px 40px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #1e293b;
    letter-spacing: -0.03em;
}

.modal-body {
    padding: 40px;
    overflow: visible;
}

.modal-footer {
    padding: 24px 40px;
    border-top: 1px solid #f1f5f9;
    background: #f8fafc;
    display: flex;
    justify-content: flex-end;
    gap: 16px;
}

/* === Formulários Premium === */
.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 14px 18px;
    font-size: 0.95rem;
    color: #1e293b;
    background: #f8fafc;
    border: 2px solid #f1f5f9;
    border-radius: 12px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    font-family: inherit;
}

.form-input:hover {
    border-color: #e2e8f0;
}

.form-input:focus {
    background: #ffffff;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.form-input::placeholder {
    color: #94a3b8;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 24px;
    font-size: 0.9rem;
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    line-height: 1;
}

.btn-primary {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--accent-glow);
}

.btn-outline {
    background: white;
    color: #475569;
    border: 2px solid #e2e8f0;
}

.btn-outline:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

/* Formulário de Busca e Paginação */
.search-form {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.search-input {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    outline: none;
    font-size: 0.9rem;
}

.search-input:focus { border-color: var(--accent); }

.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 24px;
    border-top: 1px solid #e2e8f0;
}

.pagination a {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    color: var(--gray-600);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
}

.pagination a:hover, .pagination a.active {
    background: var(--accent);
    color: var(--white);
    border-color: var(--accent);
}

/* Grid de Formulário */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

/* Select e Color Input Premium */
.form-select {
    width: 100%;
    padding: 14px 18px;
    font-size: 0.95rem;
    color: #1e293b;
    background: #f8fafc;
    border: 2px solid #f1f5f9;
    border-radius: 12px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    font-family: inherit;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 44px;
}

.form-select:hover {
    border-color: #e2e8f0;
}

.form-select:focus {
    background-color: #ffffff;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.form-color {
    width: 100%;
    height: 48px;
    padding: 4px;
    border: 2px solid #f1f5f9;
    border-radius: 12px;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.2s;
}

.form-color:hover {
    border-color: #e2e8f0;
}

.form-color:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

/* Card Body & Footer */
.admin-card-body {
    padding: 24px 32px;
}

.admin-card-footer {
    padding: 16px 32px;
    border-top: 1px solid #f1f5f9;
    background: #f8fafc;
    border-radius: 0 0 20px 20px;
}

/* Responsive form-grid */
@media (max-width: 640px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}
