﻿/* ==========================================================================
   1. CORE VARIABLES & RESET
   ========================================================================== */
:root {
    --arkesel-dark: #1a2b4b;
    --arkesel-green: #2ecc71;
    --arkesel-hover: rgba(46, 204, 113, 0.1);
    --accent-gold: #fbbf24;
    --text-muted: rgba(255, 255, 255, 0.7);
    --topbar-bg: rgba(255, 255, 255, 0.85);
    --body-bg: #f5f6fa;
    --pro-border-color: #E2E8F0;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --footer-height: 50px;
}

html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    margin: 0;
    padding-bottom: var(--footer-height);
    font-family: 'Segoe UI', 'Inter', sans-serif;
    background: var(--body-bg);
    overflow-x: hidden;
    color: #334155;
}

/* ==========================================================================
   2. SPLASH SCREEN
   ========================================================================== */
#splash {
    position: fixed;
    inset: 0;
    background: #2c3e50;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 9999;
    animation: fadeOut 1s ease forwards 1.5s;
}

    #splash .logo {
        width: 100px;
        height: 100px;
        margin-bottom: 20px;
        animation: pulse 1.5s infinite;
    }

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #fff;
    border-top: 4px solid #f39c12;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-top: 20px;
}

/* ==========================================================================
   3. SIDEBAR NAVIGATION & BRANDING
   ========================================================================== */
.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 260px;
    background-color: var(--arkesel-dark) !important;
    background: linear-gradient(180deg, #1a2b4b 0%, #111827 100%);
    z-index: 1001;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1);
    border-right: none;
    overflow-y: auto;
}

    .sidebar .navbar-brand {
        padding: 1.75rem 1.25rem;
        display: flex;
        align-items: center;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        margin-bottom: 0.5rem;
    }

.arkesel-icon-box {
    background-color: var(--arkesel-green);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transform: skewX(-15deg);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

    .arkesel-icon-box i {
        color: white;
        font-size: 1.2rem;
        transform: skewX(15deg);
    }

.navbar-brand span {
    letter-spacing: -0.5px;
}

.sidebar-menu a, .sidebar a:not(.navbar-brand) {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    margin: 4px 12px;
    color: #ffffff !important;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

    .sidebar-menu a i, .sidebar i {
        font-size: 1.2rem;
        margin-right: 15px;
        color: var(--arkesel-green);
        min-width: 25px;
        text-align: center;
    }

    .sidebar-menu a:hover, .sidebar a:not(.navbar-brand):hover {
        background-color: var(--arkesel-hover);
        color: var(--arkesel-green) !important;
        transform: translateX(4px);
    }

    .sidebar-menu a.active, .sidebar a.active {
        background-color: var(--arkesel-hover);
        border-left: 4px solid var(--arkesel-green);
        color: var(--arkesel-green) !important;
        font-weight: 600;
    }

/* Sidebar Dropdown Submenus */
.sidebar-submenu {
    padding-left: 1.5rem;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 0 0 8px 8px;
    margin: 0 12px 6px 12px;
}

    .sidebar-submenu .sidebar-link {
        padding: 8px 12px;
        font-size: 0.875rem;
        margin: 2px 0;
    }

/* Section Labels */
.user-details {
    color: rgba(255, 255, 255, 0.4) !important;
    letter-spacing: 1px;
    margin-top: 15px;
    padding-left: 20px;
}

/* ==========================================================================
   4. TOPBAR & CONTENT WORKSPACE
   ========================================================================== */
.content {
    margin-left: 260px;
    transition: var(--transition);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: var(--topbar-bg) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--pro-border-color);
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.toggle-btn {
    color: #0f172a;
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.3s ease-in-out;
}

    .toggle-btn:hover {
        color: var(--arkesel-green);
        transform: scale(1.1);
    }

    .toggle-btn.rotate {
        transform: rotate(90deg);
    }

.logout-btn {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #475569;
    padding: 6px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    transition: 0.3s;
}

    .logout-btn:hover {
        background: #fee2e2;
        color: #dc2626;
        border-color: #fecaca;
    }

/* ==========================================================================
   5. FOOTER
   ========================================================================== */
footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #fff;
    color: #333;
    text-align: center;
    padding: 10px 0;
    z-index: 1000;
    box-shadow: 0 -2px 5px rgba(0,0,0,0.05);
    height: var(--footer-height);
}

/* ==========================================================================
   6. ENTERPRISE TABLES & FORM CONTROLS
   ========================================================================== */
.form-control, .form-select {
    border: 1px solid #CBD5E1;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-size: 0.925rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

    .form-control:focus, .form-select:focus, .form-check-input:focus {
        border-color: #2563EB;
        box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
    }

.table {
    border-color: #F1F5F9;
}

    .table th {
        background-color: #F8FAFC !important;
        color: #475569;
        font-weight: 600;
        text-transform: uppercase;
        font-size: 0.75rem;
        letter-spacing: 0.05em;
        padding: 0.85rem 0.75rem;
    }

    .table td {
        padding: 1rem 0.75rem;
        vertical-align: middle;
        color: #334155;
    }

.badge {
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* ==========================================================================
   7. RESPONSIVE LOGIC
   ========================================================================== */
@media (min-width: 769px) {
    .sidebar.collapsed {
        width: 80px;
    }

        .sidebar.collapsed span,
        .sidebar.collapsed .sidebar-submenu,
        .sidebar.collapsed .user-details {
            display: none !important;
        }

        .sidebar.collapsed .navbar-brand {
            justify-content: center;
            padding: 1.5rem 0.5rem;
        }

        .sidebar.collapsed a {
            justify-content: center;
            padding: 12px 0;
            margin: 4px 8px;
        }

        .sidebar.collapsed i {
            margin-right: 0;
            font-size: 1.4rem;
        }

    .content.collapsed {
        margin-left: 80px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        left: -260px;
    }

        .sidebar.active {
            left: 0;
        }

    .content {
        margin-left: 0 !important;
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1000;
        display: none;
        backdrop-filter: blur(2px);
    }

        .sidebar-overlay.show {
            display: block;
        }
}

/* ==========================================================================
   8. WHATSAPP FLOATING SUPPORT WIDGET
   ========================================================================== */
.wa-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    font-family: 'Segoe UI', Roboto, sans-serif;
}

.wa-bubble {
    width: 60px;
    height: 60px;
    background: #25D366;
    border-radius: 50%;
    border: none;
    color: white;
    font-size: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(37, 211, 102, 0.4);
    cursor: pointer;
    transition: transform 0.3s;
}

    .wa-bubble:hover {
        transform: scale(1.1);
    }

.wa-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: #ff3b30;
    color: white;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 10px;
    border: 2px solid white;
}

.wa-card {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 320px;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    display: none;
    flex-direction: column;
    transform-origin: bottom right;
}

    .wa-card.active {
        display: flex;
        animation: wa-pop 0.3s ease-out;
    }

.wa-header {
    background: #075E54;
    padding: 20px;
    display: flex;
    align-items: center;
    color: white;
    position: relative;
}

.wa-avatar {
    position: relative;
    width: 45px;
    height: 45px;
    margin-right: 12px;
}

    .wa-avatar img {
        width: 100%;
        height: 100%;
        border-radius: 50%;
        background: white;
        object-fit: contain;
    }

.wa-online-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    background: #4ade80;
    border: 2px solid #075E54;
    border-radius: 50%;
}

.wa-staff-name {
    display: block;
    font-weight: 600;
    font-size: 16px;
}

.wa-status {
    font-size: 12px;
    opacity: 0.8;
}

.wa-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
}

.wa-body {
    padding: 20px;
    background: #f0f2f5;
}

.wa-msg {
    background: white;
    padding: 12px;
    border-radius: 0 12px 12px 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    max-width: 90%;
}

    .wa-msg p {
        margin: 0;
        font-size: 14px;
        color: #333;
    }

.wa-time {
    font-size: 10px;
    color: #999;
    display: block;
    margin-top: 5px;
    text-align: right;
}

.wa-footer {
    padding: 15px;
    background: white;
}

.wa-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #25D366;
    color: white;
    text-decoration: none;
    padding: 12px;
    border-radius: 10px;
    font-weight: 600;
    transition: background 0.2s;
}

    .wa-btn:hover {
        background: #1ebe5b;
        color: white;
    }

/* ==========================================================================
   9. ANIMATIONS
   ========================================================================== */
@keyframes fadeOut {
    to {
        opacity: 0;
        visibility: hidden;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

@keyframes wa-pop {
    from {
        opacity: 0;
        transform: scale(0.5);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}
