/**
 * KING-BAIAK ADMIN PANEL - CSS
 * Estilos modernos e responsivos
 */

:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --dark-color: #1e293b;
    --light-color: #f8fafc;
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --header-height: 60px;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f1f5f9;
    color: #334155;
    line-height: 1.6;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    color: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    overflow-y: auto;
    box-shadow: 4px 0 20px rgba(0,0,0,0.1);
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h3 {
    font-size: 1.3rem;
    margin-bottom: 5px;
    color: #fbbf24;
}

.sidebar-header small {
    color: #94a3b8;
    font-size: 0.8rem;
}

.sidebar-nav {
    padding: 15px 0;
}

.nav-item {
    margin: 2px 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #cbd5e1;
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(255,255,255,0.1);
    color: #fbbf24;
    border-left-color: #fbbf24;
}

.nav-link i {
    width: 24px;
    margin-right: 10px;
    text-align: center;
}

.nav-link .fa-chevron-down {
    margin-left: auto;
    font-size: 0.8rem;
    transition: transform 0.3s;
}

.nav-link[aria-expanded="true"] .fa-chevron-down {
    transform: rotate(180deg);
}

.submenu {
    background: rgba(0,0,0,0.2);
}

.submenu .nav-link {
    padding-left: 54px;
    font-size: 0.9rem;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: all 0.3s ease;
}

/* Topbar */
.topbar {
    height: var(--header-height);
    background: white !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 0 20px;
}

.sidebar-toggle {
    background: transparent !important;
    border: none;
    color: #64748b !important;
    font-size: 1.2rem;
    padding: 10px;
}

.sidebar-toggle:hover {
    color: #1e293b !important;
}

.navbar-brand {
    color: #1e293b !important;
    font-weight: 600;
}

/* Content Wrapper */
.content-wrapper {
    padding: 25px;
    min-height: calc(100vh - var(--header-height) - 60px);
}

/* Cards */
.card {
    background: white;
    border: none;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 25px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

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

.card-header {
    background: transparent;
    border-bottom: 1px solid #e2e8f0;
    padding: 20px 25px;
    font-weight: 600;
    color: #1e293b;
    position: relative;
}

.card-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 25px;
    width: 50px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), transparent);
    border-radius: 2px;
}

.card-body {
    padding: 25px;
}

/* Stats Cards */
.stats-card {
    position: relative;
    padding: 25px;
    border-radius: 12px;
    color: white;
    overflow: hidden;
}

.stats-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
}

.stats-card .icon {
    font-size: 3rem;
    opacity: 0.3;
    position: absolute;
    right: 20px;
    top: 20px;
}

.stats-card .number {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.stats-card .label {
    font-size: 0.9rem;
    opacity: 0.9;
}

.stats-card.bg-primary { background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%); }
.stats-card.bg-success { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.stats-card.bg-info { background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); }
.stats-card.bg-warning { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.stats-card.bg-danger { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); }

/* Tables */
.table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
}

.table {
    margin-bottom: 0;
}

.table thead th {
    background: #f8fafc;
    border: none;
    font-weight: 600;
    color: #475569;
    padding: 15px 20px;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}

.table tbody td {
    padding: 15px 20px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.table tbody tr:hover {
    background: #f8fafc;
}

/* Buttons */
.btn {
    border-radius: 8px;
    padding: 10px 20px;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.btn-action {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-success {
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-danger {
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

/* Forms */
.form-control,
.form-select {
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    padding: 12px 15px;
    font-size: 0.95rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-label {
    font-weight: 500;
    color: #475569;
    margin-bottom: 8px;
}

/* Alerts */
.alert {
    border: none;
    border-radius: 8px;
    padding: 15px 20px;
}

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    padding: 20px;
}

.login-box {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo i {
    font-size: 4rem;
    color: #fbbf24;
    margin-bottom: 10px;
    display: block;
}

.login-logo h2 {
    color: #1e293b;
    margin-top: 15px;
    margin-bottom: 5px;
    font-weight: 700;
    font-size: 1.8rem;
}

.login-logo p {
    color: #64748b;
    font-size: 0.95rem;
    margin: 0;
}

/* Footer */
.footer {
    background: white;
    padding: 20px 25px;
    text-align: center;
    border-top: 1px solid #e2e8f0;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .content-wrapper {
        padding: 15px;
    }
    
    /* Login Mobile Improvements */
    .login-page {
        padding: 15px;
        align-items: flex-start;
        padding-top: 50px;
    }
    
    .login-box {
        padding: 10px;
    }
    
    .login-card {
        padding: 30px 20px;
        border-radius: 12px;
    }
    
    .login-logo i {
        font-size: 3rem;
    }
    
    .login-logo h2 {
        font-size: 1.5rem;
    }
    
    .login-logo p {
        font-size: 0.9rem;
    }
    
    .form-control,
    .form-select {
        padding: 15px;
        font-size: 16px; /* Prevenir zoom no iOS */
    }
    
    .btn {
        padding: 15px;
        font-size: 16px;
    }
    
    .input-group .input-group-text {
        padding: 15px;
    }
    
    .alert {
        padding: 12px 15px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .login-page {
        padding: 10px;
    }
    
    .login-card {
        padding: 25px 15px;
    }
    
    .login-logo i {
        font-size: 2.5rem;
    }
    
    .login-logo h2 {
        font-size: 1.3rem;
    }
    
    .mb-4 {
        margin-bottom: 1.5rem !important;
    }
}

/* Large screens optimization */
@media (min-width: 1400px) {
    .login-box {
        max-width: 480px;
    }
}

/* DataTables Customization */
.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: 6px !important;
    margin: 0 2px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary-color) !important;
    color: white !important;
    border-color: var(--primary-color) !important;
}

/* Select2 Customization */
.select2-container--default .select2-selection--single {
    height: 45px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 45px;
    padding-left: 15px;
}

/* Summernote Customization */
.note-editor {
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e2e8f0;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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