/* ============================================
   ALY Director - Custom Styles
   Bootstrap 5.3 + Dark/Light Mode
   ============================================ */

:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --navbar-height: 60px;
    --transition-speed: 0.3s;
    --accent-color: #00d97e;
    --accent-hover: #00c06e;
    --accent-rgb: 0, 217, 126;
}

/* ============================================
   DARK MODE (default)
   ============================================ */
[data-bs-theme="dark"] {
    --bg-body: #0f1117;
    --bg-sidebar: #141620;
    --bg-card: #1a1d2e;
    --bg-card-hover: #1f2337;
    --bg-input: #1a1d2e;
    --border-color: #2a2d3e;
    --text-primary: #e4e6f0;
    --text-secondary: #8b8fa3;
    --text-muted: #5c6078;
    --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.3);
    --scrollbar-thumb: #2a2d3e;
    --scrollbar-track: #141620;
}

/* ============================================
   LIGHT MODE
   ============================================ */
[data-bs-theme="light"] {
    --bg-body: #f5f6fa;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f8f9fc;
    --bg-input: #f5f6fa;
    --border-color: #e2e5f1;
    --text-primary: #1a1d2e;
    --text-secondary: #6b7085;
    --text-muted: #9ca0b3;
    --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.08);
    --scrollbar-thumb: #d1d5e0;
    --scrollbar-track: #f0f1f5;
}

/* ============================================
   GLOBAL
   ============================================ */
body {
    background-color: var(--bg-body);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow-x: hidden;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

a {
    text-decoration: none;
    color: var(--accent-color);
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-hover);
}

::selection {
    background: rgba(var(--accent-rgb), 0.3);
    color: var(--text-primary);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    z-index: 1040;
    transition: width var(--transition-speed), transform var(--transition-speed);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    height: var(--navbar-height);
    border-bottom: 1px solid var(--border-color);
    gap: 10px;
    flex-shrink: 0;
}

.sidebar-brand .brand-icon {
    width: 34px;
    height: 34px;
    background: var(--accent-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #0f1117;
    flex-shrink: 0;
}

.sidebar-brand .brand-text {
    font-weight: 700;
    font-size: 18px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

.sidebar-section {
    padding: 0 12px;
    margin-bottom: 8px;
}

.sidebar-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    padding: 8px 12px 6px;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    gap: 12px;
    transition: all 0.2s;
    white-space: nowrap;
    overflow: hidden;
    margin-bottom: 2px;
}

.sidebar-link i {
    font-size: 18px;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-link:hover {
    background-color: var(--bg-card-hover);
    color: var(--text-primary);
}

.sidebar-link.active {
    background-color: rgba(var(--accent-rgb), 0.12);
    color: var(--accent-color);
}

.sidebar-link.active i {
    color: var(--accent-color);
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.sidebar-footer .sidebar-link {
    margin-bottom: 0;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left var(--transition-speed);
}

.main-navbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    height: var(--navbar-height);
    background-color: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    backdrop-filter: blur(10px);
}

.main-navbar .navbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.main-navbar .navbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.navbar-btn {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 18px;
}

.navbar-btn:hover {
    background-color: var(--bg-card-hover);
    color: var(--text-primary);
}

.navbar-search {
    position: relative;
    width: 280px;
}

.navbar-search input {
    width: 100%;
    padding: 8px 12px 8px 38px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.navbar-search input::placeholder {
    color: var(--text-muted);
}

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

.navbar-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 16px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-color), #6366f1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: #fff;
    cursor: pointer;
    transition: transform 0.2s;
}

.user-avatar:hover {
    transform: scale(1.05);
}

.content-wrapper {
    padding: 24px;
}

/* ============================================
   CARDS
   ============================================ */
.card-custom {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-card);
    transition: all var(--transition-speed);
    overflow: hidden;
}

.card-custom:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.card-custom .card-body {
    padding: 20px;
}

/* Stat Cards */
.stat-card {
    position: relative;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.stat-card .stat-info h6 {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.stat-card .stat-info .stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-card .stat-info .stat-change {
    font-size: 12px;
    font-weight: 500;
    margin-top: 4px;
}

.stat-card .stat-info .stat-change.positive {
    color: var(--accent-color);
}

.stat-card .stat-info .stat-change.negative {
    color: #ef4444;
}

.stat-card .stat-info .stat-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.stat-card .stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.stat-icon.bg-accent {
    background-color: rgba(var(--accent-rgb), 0.15);
    color: var(--accent-color);
}

.stat-icon.bg-purple {
    background-color: rgba(99, 102, 241, 0.15);
    color: #6366f1;
}

.stat-icon.bg-pink {
    background-color: rgba(236, 72, 153, 0.15);
    color: #ec4899;
}

.stat-icon.bg-orange {
    background-color: rgba(249, 115, 22, 0.15);
    color: #f97316;
}

/* ============================================
   CHART SECTION
   ============================================ */
.chart-tabs .nav-link {
    padding: 8px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.chart-tabs .nav-link.active {
    background-color: var(--accent-color);
    color: #0f1117;
    border-color: var(--accent-color);
    font-weight: 600;
}

.chart-tabs .nav-link:not(.active):hover {
    background-color: var(--bg-card-hover);
    color: var(--text-primary);
}

/* ============================================
   QUICK ACTIONS
   ============================================ */
.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    gap: 8px;
    width: 100%;
}

.quick-action-btn:hover {
    background-color: var(--bg-card-hover);
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

.quick-action-btn i {
    font-size: 24px;
    color: var(--accent-color);
}

.quick-action-btn span {
    font-size: 13px;
    font-weight: 500;
}

/* ============================================
   USAGE / PROGRESS BARS
   ============================================ */
.usage-item {
    margin-bottom: 16px;
}

.usage-item .usage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.usage-item .usage-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.usage-item .usage-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.progress-custom {
    height: 6px;
    border-radius: 3px;
    background-color: var(--bg-input);
    overflow: hidden;
}

.progress-custom .progress-bar {
    border-radius: 3px;
    transition: width 0.6s ease;
}

/* ============================================
   UPGRADE CARD
   ============================================ */
.upgrade-card {
    background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.1), rgba(99, 102, 241, 0.1));
    border: 1px solid rgba(var(--accent-rgb), 0.2);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.upgrade-card .upgrade-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: rgba(var(--accent-rgb), 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--accent-color);
    flex-shrink: 0;
}

.upgrade-card .upgrade-info h6 {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.upgrade-card .upgrade-info p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

/* ============================================
   BADGE
   ============================================ */
.badge-live {
    background-color: var(--accent-color);
    color: #0f1117;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    margin-left: 8px;
    vertical-align: middle;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-accent {
    background-color: var(--accent-color);
    color: #0f1117;
    border: none;
    font-weight: 600;
    border-radius: 8px;
    padding: 10px 20px;
    transition: all 0.2s;
}

.btn-accent:hover {
    background-color: var(--accent-hover);
    color: #0f1117;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.3);
}

.btn-outline-custom {
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    background: transparent;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-outline-custom:hover {
    background-color: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

/* ============================================
   THEME TOGGLE
   ============================================ */
.theme-toggle {
    cursor: pointer;
    font-size: 18px;
}

/* ============================================
   MOBILE / RESPONSIVE
   ============================================ */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1035;
}

.sidebar-toggle-mobile {
    display: none;
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .sidebar-overlay.show {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar-toggle-mobile {
        display: flex;
    }

    .navbar-search {
        display: none;
    }
}

@media (max-width: 575.98px) {
    .content-wrapper {
        padding: 16px;
    }

    .stat-card .stat-info .stat-value {
        font-size: 22px;
    }
}

/* ============================================
   AUTH PAGES (Login, Register, etc.)
   ============================================ */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-body);
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    padding: 40px;
}

.auth-card h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 8px;
}

.auth-card .auth-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 32px;
}

.auth-social-btn {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 12px;
}

.auth-social-btn:hover {
    background-color: var(--bg-card-hover);
    border-color: var(--text-muted);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background-color: var(--border-color);
}

.auth-form .form-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.auth-form .form-control {
    padding: 10px 12px 10px 40px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-input);
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-form .form-control::placeholder {
    color: var(--text-muted);
}

.auth-form .form-control:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15);
    background-color: var(--bg-input);
    color: var(--text-primary);
}

.auth-form .input-group-icon {
    position: relative;
}

.auth-form .input-group-icon i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 16px;
    z-index: 4;
}

.auth-form .form-check-input {
    border-color: var(--border-color);
    background-color: var(--bg-input);
}

.auth-form .form-check-input:checked {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}

.auth-form .form-check-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.btn-auth {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    background: var(--accent-color);
    color: #0f1117;
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-auth:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(var(--accent-rgb), 0.3);
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--accent-color);
    font-weight: 500;
}

/* ============================================
   NOTIFICATION DOT
   ============================================ */
.notification-dot {
    position: relative;
}

.notification-dot::after {
    content: '';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background-color: #ef4444;
    border-radius: 50%;
    border: 2px solid var(--bg-sidebar);
}

/* ============================================
   DROPDOWN CUSTOM
   ============================================ */
.dropdown-menu-custom {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow-card);
    padding: 6px;
}

.dropdown-menu-custom .dropdown-item {
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    color: var(--text-secondary);
    transition: all 0.15s;
}

.dropdown-menu-custom .dropdown-item:hover {
    background-color: var(--bg-card-hover);
    color: var(--text-primary);
}

.dropdown-menu-custom .dropdown-divider {
    border-color: var(--border-color);
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeInUp 0.4s ease forwards;
}

.animate-fade-in:nth-child(1) { animation-delay: 0.05s; }
.animate-fade-in:nth-child(2) { animation-delay: 0.1s; }
.animate-fade-in:nth-child(3) { animation-delay: 0.15s; }
.animate-fade-in:nth-child(4) { animation-delay: 0.2s; }

/* ============================================
   TABLES
   ============================================ */
.table {
    --bs-table-bg: transparent;
    --bs-table-hover-bg: var(--bg-card-hover);
    margin-bottom: 0;
}

.table th {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color) !important;
}

.table td {
    border-bottom: 1px solid var(--border-color);
    padding: 12px 16px;
    vertical-align: middle;
    font-size: 14px;
    color: var(--text-secondary);
}

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

.table .badge {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
}

/* ============================================
   MODALS
   ============================================ */
.modal-backdrop {
    backdrop-filter: blur(4px);
}

.modal .btn-close-white {
    filter: invert(1) grayscale(100%) brightness(200%);
}

[data-bs-theme="light"] .modal .btn-close-white {
    filter: none;
}

.modal .form-control:focus,
.modal .form-select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15);
}

/* ============================================
   FORM SELECT CUSTOM
   ============================================ */
.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%238b8fa3' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

/* ============================================
   FORM CHECK CUSTOM (for rol_permisos)
   ============================================ */
.form-check-input {
    border-color: var(--border-color);
    background-color: var(--bg-input);
    cursor: pointer;
}

.form-check-input:checked {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}

.form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15);
    border-color: var(--accent-color);
}

/* ============================================
   OFFCANVAS EMPRESA
   ============================================ */
.offcanvas .nav-tabs {
    border-color: var(--border-color);
}

.offcanvas .nav-tabs .nav-link {
    color: var(--text-muted);
    border: none;
    border-bottom: 2px solid transparent;
    padding: 8px 12px;
    font-size: 13px;
    transition: all 0.2s;
}

.offcanvas .nav-tabs .nav-link:hover:not(.disabled) {
    color: var(--text-primary);
    border-bottom-color: var(--border-color);
}

.offcanvas .nav-tabs .nav-link.active {
    color: var(--accent-color);
    background: transparent;
    border-bottom-color: var(--accent-color);
}

.offcanvas .nav-tabs .nav-link.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
