/* 
    Stenrio Admin - Professional SaaS Design System
    Color Palette (Slate/Indigo/Sky):
*/

:root {
    --primary: #0ea5e9; /* Sky 500 */
    --primary-dark: #0284c7;
    --secondary: #6366f1; /* Indigo 500 */
    --sidebar-bg: #0f172a; /* Slate 900 */
    --bg-main: #f8fafc; /* Slate 50 */
    --bg-card: #ffffff;
    --text-main: #1e293b; /* Slate 800 */
    --text-muted: #64748b; /* Slate 500 */
    --border-color: #e2e8f0; /* Slate 200 */
    --danger: #ef4444; /* Red 500 */
    --success: #10b981; /* Emerald 500 */
    --warning: #f59e0b; /* Amber 500 */
    
    /* Layout */
    --sidebar-width: 260px;
    --header-height: 70px;
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 8px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    overflow: hidden;
    line-height: 1.5;
}

/* Custom Scrollbar - Cleaner and Pro */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

body.dark-mode ::webkit-scrollbar-thumb {
    background: #334155;
}

/* Hide scroller but keep scroll - request by user */
.sidebar, .nav-links, .main-content, .modal-content {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.sidebar::-webkit-scrollbar, 
.nav-links::-webkit-scrollbar, 
.main-content::-webkit-scrollbar, 
.modal-content::-webkit-scrollbar {
    display: none; /* Fully hidden per user request */
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: #f1f5f9;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    padding: 24px 0;
    box-shadow: 4px 0 10px rgba(0,0,0,0.1);
}

.sidebar-logo {
    padding: 0 24px 40px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo img {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: cover;
}

.logo-text {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #38bdf8, #818cf8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    flex: 1;
    list-style: none;
    padding: 0 16px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.nav-group-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #475569;
    font-weight: 800;
    margin: 24px 10px 10px;
    padding-bottom: 5px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 2px;
}

.nav-link i {
    font-size: 18px;
    width: 24px;
    display: flex;
    justify-content: center;
    transition: transform 0.3s;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.nav-link:hover i {
    transform: translateX(3px);
}

.nav-link.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    box-shadow: 0 10px 15px -3px rgba(14, 165, 233, 0.3);
    position: relative;
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: -16px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 20px;
    background: white;
    border-radius: 0 4px 4px 0;
}

.nav-link.active i {
    color: #fff;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
}

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

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    height: 100vh;
    overflow-y: auto;
    padding: 32px;
    scroll-behavior: smooth;
}

header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px;
    margin-bottom: 32px;
    position: sticky;
    top: 0;
    z-index: 500;
    background: rgba(248, 250, 252, 0.8);
    backdrop-filter: blur(12px);
}

body.dark-mode header {
    background: rgba(2, 6, 23, 0.8);
}

.page-title {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

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

.header-btn {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-muted);
}

.header-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #f0f9ff;
}

/* Dashboard Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.icon-blue { background: #e0f2fe; color: #0284c7; }
.icon-indigo { background: #eef2ff; color: #4f46e5; }
.icon-emerald { background: #ecfdf5; color: #059669; }
.icon-amber { background: #fffbeb; color: #d97706; }

.stat-value {
    font-size: 30px;
    font-weight: 800;
    color: var(--text-main);
}

.stat-label {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 600;
}

/* Cards & Tables */
.card {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 24px;
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th {
    text-align: left;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    background: #f8fafc;
}

td {
    padding: 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}

tr:hover td {
    background-color: #f9fafb;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }

.btn-outline { background: white; border-color: var(--border-color); color: var(--text-main); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: #f0f9ff; }

.btn-danger { background: #fef2f2; color: #ef4444; border-color: #fee2e2; }
.btn-danger:hover { background: #ef4444; color: white; }

/* Status Badges */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-new { background: #dcfce7; color: #15803d; }
.badge-pending { background: #fef9c3; color: #a16207; }
.badge-closed { background: #f1f5f9; color: #475569; }

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    background: white;
    width: 100%;
    max-width: 600px;
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: modalSlide 0.3s ease-out;
}

@keyframes modalSlide {
    from { opacity: 0; transform: translateY(20px); scale: 0.95; }
    to { opacity: 1; transform: translateY(0); scale: 1; }
}

@keyframes sectionFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.content-section.active {
    display: block !important;
    animation: sectionFadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: cardEntrance 0.6s backwards;
}

@keyframes cardEntrance {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }

.stat-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    border-color: var(--primary);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

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

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

.form-control {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    outline: none;
    font-size: 14px;
    transition: all 0.2s;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.1);
}

/* Utility Classes */
.d-none { display: none !important; }
.content-section.active { display: block !important; }
.nav-link.active { display: flex !important; }
.m-t20 { margin-top: 20px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
@media (max-width: 768px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* Dark Mode Overrides */
body.dark-mode {
    --bg-main: #020617;
    --bg-card: #0f172a;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border-color: #334155;
}

body.dark-mode .card, 
body.dark-mode .stat-card,
body.dark-mode .modal-content,
body.dark-mode .header-btn,
body.dark-mode .form-control {
    background-color: var(--bg-card);
    border-color: var(--border-color);
}

body.dark-mode input, body.dark-mode select, body.dark-mode textarea {
    color: white;
}

body.dark-mode th {
    background-color: #1e293b;
}

body.dark-mode td {
    color: #e2e8f0;
}

body.dark-mode tr:hover td {
    background-color: #1e293b;
}

body.dark-mode .header-btn:hover,
body.dark-mode .btn-outline:hover {
    background-color: #1e293b;
    border-color: var(--primary);
    color: var(--primary);
}

body.dark-mode .stat-card:hover {
    background-color: #1e293b;
    border-color: var(--primary);
}

/* Fix visible button text */
body.dark-mode .btn-outline, 
body.dark-mode .header-btn {
    background-color: #1e293b;
    color: #f1f5f9;
}

body.dark-mode .btn-primary {
    color: white !important;
}

body.dark-mode .btn-outline:hover, 
body.dark-mode .header-btn:hover {
    background-color: #334155;
    color: var(--primary) !important;
}

/* ===================================
   FULLY COMPREHENSIVE RESPONSIVE CSS
   =================================== */

/* --- TABLET & SMALL LAPTOPS (max 1024px) --- */
@media (max-width: 1024px) {
    :root { --sidebar-width: 0px; }

    /* Sidebar becomes overlay */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 2001;
        width: 260px !important;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 30px rgba(0,0,0,0.3);
    }

    /* Overlay backdrop when sidebar is open */
    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 2000;
        backdrop-filter: blur(2px);
    }
    .sidebar-backdrop.visible { display: block; }

    /* Main content fills full width */
    .main-content { margin-left: 0; padding: 20px; }

    /* Show hamburger toggle */
    #sidebar-toggle { display: flex !important; }

    /* Collapse grids */
    .stats-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .grid-3 { grid-template-columns: repeat(2, 1fr) !important; }
    .grid-2 { grid-template-columns: 1fr !important; }

    /* Careers layout stack vertically */
    #careers > div { flex-direction: column !important; }

    /* Settings form grid */
    #settings-form .grid-2 { grid-template-columns: 1fr !important; }
}

/* --- MOBILE LANDSCAPE & LARGE PHONES (max 768px) --- */
@media (max-width: 768px) {
    .main-content { padding: 16px; }

    /* Header stacks vertically */
    header {
        flex-wrap: wrap;
        height: auto;
        padding: 12px 0;
        margin-bottom: 20px;
        gap: 12px;
    }
    header > div:first-child { flex: 1; }
    .header-right { width: 100%; justify-content: flex-end; }

    /* Page title smaller */
    .page-title { font-size: 20px; }

    /* Stats grid: 1 column */
    .stats-grid { grid-template-columns: 1fr 1fr !important; gap: 12px !important; }

    /* All grids single column */
    .grid-2, .grid-3 { grid-template-columns: 1fr !important; gap: 16px !important; }

    /* Stat card compact */
    .stat-card { padding: 20px; }
    .stat-card h2 { font-size: 2rem; }

    /* Cards */
    .card { padding: 16px; }
    .card-title { flex-direction: column; align-items: flex-start; gap: 12px; }
    .card-title button { width: 100%; justify-content: center; }

    /* Tables: add horizontal scroll */
    .card table, table { min-width: 550px; }
    .card { overflow-x: auto; }

    /* Modal fullscreen on mobile */
    .modal-overlay { align-items: flex-end; padding: 0; }
    .modal-content {
        border-radius: 20px 20px 0 0;
        max-height: 90vh;
        overflow-y: auto;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0;
        padding: 24px;
    }

    /* Quick add btn - icon only */
    #add-btn-global span { display: none; }
    #add-btn-global { width: 40px; padding: 0; border-radius: 10px; justify-content: center; }

    /* Careers section */
    #careers > div { flex-direction: column !important; }

    /* Settings */
    .settings-social-grid { grid-template-columns: 1fr !important; }
}

/* --- SMALL PHONES (max 480px) --- */
@media (max-width: 480px) {
    .main-content { padding: 12px; }

    .stats-grid { grid-template-columns: 1fr !important; gap: 10px !important; }

    .page-title { font-size: 18px; }

    header { margin-bottom: 16px; }

    .stat-card { padding: 16px 18px; }

    /* Header right: spaced out */
    .header-right { gap: 8px; }
    .header-btn { width: 36px; height: 36px; }

    /* Login card responsive */
    .login-card { padding: 28px 20px; border-radius: 16px; }

    /* Nav link text hidden on tiny screens (only icons) - keep flex */
    .sidebar .logo-text { font-size: 16px; }

    .user-info span { font-size: 12px !important; }
}
