/* ═══════════════════════════════════════════════════════════════
   WSM/dPanel — Classic Professional Design System
   Blue & White Corporate Theme
   ═══════════════════════════════════════════════════════════════ */

/* ── CSS Variables ── */
:root {
    /* Primary Colors */
    --primary: #1e40af;
    --primary-light: #3b82f6;
    --primary-dark: #1e3a8a;
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;
    --primary-200: #bfdbfe;
    --primary-600: #2563eb;
    --primary-700: #1d4ed8;

    /* WSM Accent */
    --wsm-accent: #2563eb;
    --wsm-accent-hover: #1d4ed8;

    /* Neutrals */
    --white: #ffffff;
    --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;

    /* Text */
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    /* Status */
    --success: #059669;
    --success-bg: #ecfdf5;
    --warning: #d97706;
    --warning-bg: #fffbeb;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --info: #0284c7;
    --info-bg: #f0f9ff;

    /* Surfaces */
    --body-bg: #f1f5f9;
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    --card-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.1);

    /* Font */
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Spacing */
    --sidebar-width: 260px;
    --header-height: 60px;
    --radius: 8px;
    --radius-lg: 12px;
}

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

body {
    background: var(--body-bg);
    color: var(--text-primary);
    font-family: var(--font-main);
    min-height: 100vh;
    overflow-x: hidden;
    font-size: 14px;
    line-height: 1.5;
}

a { color: var(--primary-light); text-decoration: none; transition: color 0.2s ease; }
a:hover { color: var(--primary-dark); }

::selection { background: var(--primary-200); color: var(--primary-dark); }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ── Layout ── */
.wsm-wrapper {
    display: flex;
    min-height: 100vh;
}

.wsm-sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--white);
    border-right: 1px solid var(--gray-200);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.25s ease;
    overflow-y: auto;
    box-shadow: 1px 0 4px rgba(0, 0, 0, 0.04);
}

.wsm-sidebar.collapsed { transform: translateX(-100%); }

.wsm-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.25s ease;
    background: var(--body-bg);
}

.wsm-main.expanded { margin-left: 0; }

/* ── Sidebar Brand ── */
.sidebar-brand {
    padding: 18px 20px;
    text-align: center;
    border-bottom: 1px solid var(--gray-200);
    background: var(--primary-dark);
}

.sidebar-brand h2 {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--white);
    margin: 0;
    background: none;
    -webkit-text-fill-color: unset;
}

.sidebar-brand small {
    display: block;
    color: var(--primary-200);
    font-size: 0.68rem;
    letter-spacing: 1px;
    margin-top: 3px;
    text-transform: uppercase;
}

/* ── Sidebar Navigation ── */
.sidebar-nav { padding: 12px 0; flex: 1; }

.nav-section {
    padding: 10px 20px 4px;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--gray-400);
    font-weight: 600;
    margin-top: 8px;
}

.sidebar-nav .nav-item { margin: 1px 8px; }

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 9px 14px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 0.84rem;
    font-weight: 450;
    transition: all 0.2s ease;
    position: relative;
}

.sidebar-nav .nav-link i {
    width: 20px;
    margin-right: 10px;
    font-size: 0.85rem;
    text-align: center;
    color: var(--gray-400);
    transition: color 0.2s ease;
}

.sidebar-nav .nav-link:hover {
    background: var(--gray-50);
    color: var(--text-primary);
}

.sidebar-nav .nav-link:hover i { color: var(--primary-light); }

.sidebar-nav .nav-link.active {
    background: var(--primary-50);
    color: var(--primary);
    font-weight: 600;
    border: none;
    box-shadow: none;
}

.sidebar-nav .nav-link.active i { color: var(--primary-light); }

.sidebar-nav .nav-link.active::before {
    content: '';
    position: absolute;
    left: 0; top: 4px; bottom: 4px;
    width: 3px;
    background: var(--primary-light);
    border-radius: 0 3px 3px 0;
}

/* ── Top Header ── */
.wsm-header {
    height: var(--header-height);
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 999;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.wsm-header .toggle-btn {
    background: none;
    border: 1px solid var(--gray-200);
    color: var(--gray-500);
    width: 36px; height: 36px;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s ease;
}

.wsm-header .toggle-btn:hover {
    background: var(--gray-50);
    color: var(--primary-light);
    border-color: var(--primary-200);
}

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

.header-right .user-info {
    display: flex; align-items: center; gap: 10px;
    padding: 5px 14px;
    background: var(--gray-50);
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
}

.header-right .user-info .avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.78rem; font-weight: 600; color: var(--white);
}

.header-right .btn-logout {
    padding: 6px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--danger);
    background: var(--danger-bg);
    color: var(--danger);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.header-right .btn-logout:hover {
    background: var(--danger);
    color: var(--white);
}

/* ── Content Area ── */
.wsm-content { padding: 24px; flex: 1; }

.page-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 4px;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 24px;
}

/* ── Cards ── */
.glass-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    padding: 24px;
    margin-bottom: 20px;
    transition: box-shadow 0.2s ease;
    position: relative;
}

.glass-card::before { display: none; }

.glass-card:hover {
    box-shadow: var(--card-shadow-hover);
    transform: none;
    border-color: var(--gray-300);
}

.glass-card .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--gray-200);
}

.glass-card .card-header h5 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    gap: 10px;
}

.glass-card .card-header h5 i { color: var(--primary-light); }

/* ── Stat Cards ── */
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 22px;
    transition: box-shadow 0.2s ease;
    box-shadow: var(--card-shadow);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--card-shadow-hover);
}

.stat-card .stat-icon {
    width: 48px; height: 48px;
    border-radius: var(--radius-lg);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
    margin-bottom: 14px;
}

.stat-card .stat-icon.blue { background: var(--primary-100); color: var(--primary-light); }
.stat-card .stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-card .stat-icon.orange { background: var(--warning-bg); color: var(--warning); }
.stat-card .stat-icon.red { background: var(--danger-bg); color: var(--danger); }
.stat-card .stat-icon.purple { background: #f5f3ff; color: #7c3aed; }

.stat-card .stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--gray-800);
    line-height: 1.2;
    margin-bottom: 4px;
}

.stat-card .stat-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.stat-card::after { display: none; }

/* ── Tables ── */
.table-glass { width: 100%; border-collapse: separate; border-spacing: 0; }
.table-glass th, .table-glass td { padding: 11px 16px; text-align: left; border-bottom: 1px solid var(--gray-200); }
.table-glass thead th {
    color: var(--gray-600);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    background: var(--gray-50);
    white-space: nowrap;
}
.table-glass thead th:first-child { border-radius: var(--radius) 0 0 0; }
.table-glass thead th:last-child { border-radius: 0 var(--radius) 0 0; }
.table-glass tbody tr { transition: background 0.15s ease; }
.table-glass tbody tr:hover { background: var(--primary-50); }
.table-glass tbody td { color: var(--text-primary); font-size: 0.84rem; }

/* ── Forms ── */
.form-control, .form-select {
    background: var(--white) !important;
    border: 1px solid var(--gray-300) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius) !important;
    padding: 9px 14px !important;
    font-size: 0.85rem !important;
    font-family: var(--font-main) !important;
    width: 100% !important;
    display: block;
    box-sizing: border-box !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.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='%23475569' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 12px !important;
    padding-right: 36px !important;
}

.form-control:focus, .form-select:focus {
    background: var(--white) !important;
    border-color: var(--primary-light) !important;
    box-shadow: 0 0 0 3px var(--primary-100) !important;
    outline: none !important;
}

.form-control::placeholder { color: var(--gray-400) !important; }

.form-label {
    display: block;
    color: var(--gray-600);
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* ── Buttons ── */
.btn-wsm {
    background: var(--primary-light);
    border: none;
    color: var(--white);
    font-weight: 600;
    padding: 9px 22px;
    border-radius: var(--radius);
    font-size: 0.84rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}

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

.btn-glass {
    background: var(--white);
    border: 1px solid var(--gray-300);
    color: var(--text-primary);
    padding: 9px 22px;
    border-radius: var(--radius);
    font-size: 0.84rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-glass:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
    color: var(--text-primary);
}

.btn-glass-success { border-color: var(--success); color: var(--success); }
.btn-glass-success:hover { background: var(--success-bg); border-color: var(--success); color: var(--success); }
.btn-glass-danger { border-color: var(--danger); color: var(--danger); }
.btn-glass-danger:hover { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.btn-glass-warning { border-color: var(--warning); color: var(--warning); }
.btn-glass-warning:hover { background: var(--warning-bg); border-color: var(--warning); color: var(--warning); }
.btn-glass-info { border-color: var(--info); color: var(--info); }
.btn-glass-info:hover { background: var(--info-bg); border-color: var(--info); color: var(--info); }

.btn-sm { padding: 5px 12px; font-size: 0.78rem; }

/* ── Badges ── */
.badge-glass {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.badge-success { background: var(--success-bg); color: var(--success); border: 1px solid #a7f3d0; }
.badge-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid #fecaca; }
.badge-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid #fde68a; }
.badge-info { background: var(--info-bg); color: var(--info); border: 1px solid #bae6fd; }

/* ── Alerts ── */
.glass-alert {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    color: var(--text-primary);
    padding: 14px 18px;
    font-size: 0.85rem;
}

.glass-alert.alert-success { border-left: 4px solid var(--success); background: var(--success-bg); }
.glass-alert.alert-danger { border-left: 4px solid var(--danger); background: var(--danger-bg); }
.glass-alert.alert-warning { border-left: 4px solid var(--warning); background: var(--warning-bg); }
.glass-alert.alert-info { border-left: 4px solid var(--info); background: var(--info-bg); }
.glass-alert .btn-close { filter: none; }

/* ── Modals ── */
.modal-content {
    background: var(--white) !important;
    border: 1px solid var(--gray-200) !important;
    border-radius: var(--radius-lg) !important;
    color: var(--text-primary);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.modal-header { border-bottom: 1px solid var(--gray-200) !important; }
.modal-footer { border-top: 1px solid var(--gray-200) !important; }

/* ── Progress Bars ── */
.progress-glass {
    height: 8px;
    background: var(--gray-100);
    border-radius: 10px;
    overflow: hidden;
}

.progress-glass .bar {
    height: 100%;
    border-radius: 10px;
    transition: width 0.6s ease;
}

.progress-glass .bar-blue { background: var(--primary-light); }
.progress-glass .bar-green { background: var(--success); }
.progress-glass .bar-orange { background: var(--warning); }
.progress-glass .bar-red { background: var(--danger); }

/* ── Toast Notifications ── */
.toast-container {
    position: fixed;
    top: 20px; right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast-glass {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 14px 18px;
    min-width: 300px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ── Login Page ── */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, #1e3a8a 100%);
    position: relative;
    z-index: 1;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--white);
    border: none;
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    position: relative;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--primary-light);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.login-card .login-title {
    font-size: 1.6rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 6px;
    color: var(--primary-dark);
    background: none;
    -webkit-text-fill-color: unset;
}

.login-card .login-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 30px;
}

/* ── Particles (disabled) ── */
.particles { display: none; }
.particle { display: none; }

/* ── Skeleton Loading ── */
.skeleton {
    background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── DataTables Override ── */
.dataTables_wrapper .dataTables_filter input { background: var(--white) !important; border: 1px solid var(--gray-300) !important; color: var(--text-primary) !important; border-radius: var(--radius) !important; padding: 6px 12px !important; }
.dataTables_wrapper .dataTables_length select { background: var(--white) !important; border: 1px solid var(--gray-300) !important; color: var(--text-primary) !important; border-radius: var(--radius) !important; }
.dataTables_wrapper .dataTables_info { color: var(--text-secondary) !important; font-size: 0.8rem; }
.dataTables_wrapper .dataTables_paginate .paginate_button { background: var(--white) !important; border: 1px solid var(--gray-200) !important; color: var(--text-secondary) !important; border-radius: var(--radius) !important; margin: 0 2px !important; }
.dataTables_wrapper .dataTables_paginate .paginate_button.current { background: var(--primary-light) !important; color: var(--white) !important; border: none !important; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .wsm-sidebar { transform: translateX(-100%); }
    .wsm-sidebar.mobile-open { transform: translateX(0); }
    .wsm-main { margin-left: 0 !important; }
    .wsm-content { padding: 16px; }
    .stat-card .stat-value { font-size: 1.3rem; }
}

/* ── Utilities ── */
.text-accent { color: var(--primary-light); }
.gap-20 { gap: 20px; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
