/* ========================================
   SISTEMA CERÂMICA - LAYOUT CORRIGIDO
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2c3e50;
    --secondary: #3498db;
    --success: #27ae60;
    --danger: #e74c3c;
    --warning: #f39c12;
    --info: #3498db;
    --light: #ecf0f1;
    --dark: #2c3e50;
    --sidebar-width: 250px;
    --header-height: 70px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f6fa;
    color: #2c3e50;
    line-height: 1.6;
}

/* ========================================
   HEADER FIXO NO TOPO
   ======================================== */
.top-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-section i {
    font-size: 2rem;
    color: var(--secondary);
}

.logo-section h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark);
}

.user-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: var(--light);
    border-radius: 25px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
}

.user-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.user-role {
    font-size: 0.8rem;
    color: #7f8c8d;
}

.menu-toggle {
    display: none;
    background: var(--secondary);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.3rem;
}

/* ========================================
   CONTAINER PRINCIPAL (SIDEBAR + CONTEÚDO)
   ======================================== */
.main-container {
    display: flex;
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
}

/* ========================================
   SIDEBAR - MENU LATERAL FIXO
   ======================================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--primary);
    height: calc(100vh - var(--header-height));
    position: fixed;
    left: 0;
    top: var(--header-height);
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.sidebar::-webkit-scrollbar {
    width: 5px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--secondary);
    border-radius: 10px;
}

/* Seções do Menu */
.menu-section {
    margin: 20px 0;
}

.menu-section-title {
    padding: 10px 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #95a5a6;
    letter-spacing: 1px;
}

.menu-section ul {
    list-style: none;
}

.menu-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: #ecf0f1;
    text-decoration: none;
    transition: all 0.3s ease;
}

.menu-item a i {
    font-size: 1.2rem;
    width: 20px;
    text-align: center;
    color: #95a5a6;
}

.menu-item a span {
    font-size: 0.95rem;
}

.menu-item a:hover {
    background: rgba(52, 152, 219, 0.15);
    padding-left: 25px;
    color: white;
}

.menu-item a:hover i {
    color: var(--secondary);
}

.menu-item.active a {
    background: rgba(52, 152, 219, 0.2);
    border-left: 4px solid var(--secondary);
    color: white;
}

.menu-logout a {
    color: #e74c3c !important;
}

/* ========================================
   CONTEÚDO PRINCIPAL - AO LADO DO MENU
   ======================================== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 20px;
    background: #f5f6fa;
}

.content-wrapper {
    max-width: 1400px;
    margin: 0 auto;
}

/* ========================================
   PAGE HEADER
   ======================================== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.page-title h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-title h1 i {
    color: var(--secondary);
}

.page-title p {
    color: #7f8c8d;
    margin-top: 5px;
}

/* ========================================
   CARDS
   ======================================== */
.card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 25px;
    overflow: hidden;
}

.card-header {
    background: linear-gradient(135deg, var(--secondary), #2980b9);
    color: white;
    padding: 18px 25px;
}

.card-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-body {
    padding: 25px;
}

/* ========================================
   DASHBOARD CARDS
   ======================================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s ease;
    border-left: 4px solid var(--secondary);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.stat-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--secondary), #2980b9);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: white;
}

.stat-info h3 {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #7f8c8d;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--dark);
}

.stat-card.success { border-left-color: var(--success); }
.stat-card.success .stat-icon { background: linear-gradient(135deg, var(--success), #229954); }

.stat-card.danger { border-left-color: var(--danger); }
.stat-card.danger .stat-icon { background: linear-gradient(135deg, var(--danger), #c0392b); }

.stat-card.warning { border-left-color: var(--warning); }
.stat-card.warning .stat-icon { background: linear-gradient(135deg, var(--warning), #d68910); }

.stat-card.info { border-left-color: var(--info); }
.stat-card.info .stat-icon { background: linear-gradient(135deg, var(--info), #2874a6); }

/* ========================================
   FORMS
   ======================================== */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--secondary);
}

/* ========================================
   BUTTONS
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
}

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

.btn-primary:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

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

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

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

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

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

.btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ========================================
   TABLES
   ======================================== */
.table-responsive {
    overflow-x: auto;
    padding: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

table thead {
    background: linear-gradient(135deg, var(--secondary), #2980b9);
}

table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: white;
    font-size: 0.9rem;
}

table td {
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
}

table tbody tr:hover {
    background: #f8f9fa;
}

.badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-success { background: #d4edda; color: #155724; }
.badge-danger { background: #f8d7da; color: #721c24; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-info { background: #d1ecf1; color: #0c5460; }

/* ========================================
   ALERTS
   ======================================== */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-left: 4px solid;
}

.alert-success { background: #d4edda; color: #155724; border-left-color: var(--success); }
.alert-danger { background: #f8d7da; color: #721c24; border-left-color: var(--danger); }
.alert-warning { background: #fff3cd; color: #856404; border-left-color: var(--warning); }
.alert-info { background: #d1ecf1; color: #0c5460; border-left-color: var(--info); }

/* ========================================
   FILTROS COMPACTOS
   ======================================== */
.filters-compact {
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 20px;
}

.filters-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    align-items: end;
}

.filter-item {
    display: flex;
    flex-direction: column;
}

.filter-item label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 5px;
}

.filter-item input,
.filter-item select {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border 0.3s ease;
}

.filter-item input:focus,
.filter-item select:focus {
    outline: none;
    border-color: var(--secondary);
}

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

.filter-actions .btn {
    padding: 8px 16px;
    font-size: 0.9rem;
}

/* ========================================
   FOOTER
   ======================================== */
footer {
    margin-left: var(--sidebar-width);
    background: white;
    padding: 20px;
    text-align: center;
    color: #7f8c8d;
    border-top: 1px solid #e0e0e0;
}

/* ========================================
   RESPONSIVE - MOBILE
   ======================================== */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }
    
    .sidebar {
        transform: translateX(-100%);
        z-index: 999;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    footer {
        margin-left: 0;
    }
    
    .user-details {
        display: none;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media print {
    .top-header, .sidebar, footer, .btn, .menu-toggle {
        display: none !important;
    }
    .main-content {
        margin-left: 0;
    }
}
