/**
 * Global styles for SKL System
 * This file contains base styles, layout, and common components.
 */

:root {
    /* Modern Color Palette */
    --secondary-color: #f8f9fa;
    --accent-color: #4895ef;
    --success-color: #4cc9f0;
    --sidebar-bg: #ffffff;
    --sidebar-text: #64748b;
    --sidebar-active-bg: rgba(67, 97, 238, 0.08);
    --body-bg: #f8fafc;
    --glass-card: #ffffff;
}

* {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--body-bg);
    color: #1e293b;
    min-height: 100vh;
    overflow-x: hidden;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Sidebar Styling */
.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1050;
    padding: 0;
    width: 280px;
    background-color: var(--sidebar-bg) !important;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    border-right: 1px solid #e2e8f0;
}

.main-content {
    margin-left: 280px;
    padding: 1.25rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 100vh;
}

/* Collapsed Sidebar */
body.sidebar-collapsed .sidebar {
    margin-left: -280px;
}

body.sidebar-collapsed .main-content {
    margin-left: 0;
}

/* Top Navbar / Header Bar */
.top-header {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    padding: 0.75rem 2rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    margin: -1.25rem -1.25rem 2rem -1.25rem;
    display: flex;
    align-items: center;
}

.toggle-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--primary-color);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-btn:hover {
    background: rgba(67, 97, 238, 0.1);
}

@media (max-width: 991.98px) {
    .sidebar {
        margin-left: -280px;
    }

    .sidebar.show {
        margin-left: 0;
    }

    .main-content {
        margin-left: 0;
        padding: 1.5rem;
    }

    .top-header {
        margin: -1.5rem -1.5rem 1.5rem -1.5rem;
        padding: 0.75rem 1.5rem;
    }
}

/* Overlay for mobile */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    display: none;
}

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

/* Card and Components */
.card {
    background: var(--glass-card);
    border: none;
    border-radius: 1rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.03), 0 4px 6px -2px rgba(0, 0, 0, 0.01);
    backdrop-filter: blur(10px);
    transition: transform 0.2s;
}

.btn-primary {
    background-color: var(--primary-color);
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    box-shadow: 0 4px 6px -1px rgba(67, 97, 238, 0.3);
    transition: all 0.3s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
}

/* Mobile Bottom Nav CSS */
.mobile-bottom-nav {
    z-index: 2000;
    padding-bottom: env(safe-area-inset-bottom);
}
.mobile-bottom-nav .nav-item {
    transition: all 0.2s;
    flex: 1;
}
.mobile-bottom-nav .nav-item.active {
    color: var(--primary-color) !important;
}
.mobile-bottom-nav .nav-item i {
    font-size: 1.25rem;
}

@media (max-width: 767.98px) {
    .main-content {
        margin-left: 0;
        padding: 1rem;
        padding-bottom: 80px; /* Space for bottom nav */
    }
    .top-header {
        margin: -1rem -1rem 1.5rem -1rem;
        padding: 0.75rem 1rem;
    }
    .sidebar {
        margin-left: -280px;
        z-index: 2050; /* Higher than bottom nav */
        display: block !important; /* Override collapse */
    }
    body.sidebar-open .sidebar {
        margin-left: 0 !important;
    }
    body.sidebar-open .sidebar-overlay {
        display: block !important;
        z-index: 2040;
    }
}

.form-control,
.form-select {
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
    padding: 0.6rem 1rem;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
}
