/* ===================================
   META BUSINESS SUITE - 2026 REFRESH
   Fresh, Clean, Modern, Professional.
   =================================== */

:root {
    /* Brand Colors */
    --primary: #1877F2;          /* Meta Blue */
    --primary-hover: #166FE5;
    --primary-soft: #E7F3FF;     /* Light blue background */
    
    /* Neutral Palette - The "Fresh" Look */
    --bg-body: #F0F2F5;          /* Light gray background */
    --bg-surface: #FFFFFF;       /* Pure white panels */
    --bg-input: #FFFFFF;
    
    /* Text Colors */
    --text-main: #050505;
    --text-muted: #65676B;
    --text-light: #B0B3B8;
    
    /* Borders & Dividers */
    --border-color: #DADDE1;
    --border-focus: #1877F2;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08); /* Soft lift */
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    
    /* Dimensions */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --header-height: 64px;
    --radius: 10px;
}

/* Reset */
* { box-sizing: border-box; margin: 0; padding: 0; outline: none; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    font-size: 14px;
    line-height: 1.5;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

/* ===================================
   LAYOUT STRUCTURE
   =================================== */

.main-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    box-shadow: var(--shadow-sm);
}

.sidebar.hidden {
    /* For fully hiding on mobile */
    transform: translateX(-100%);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid transparent; 
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
    overflow: hidden;
}

.nav-menu {
    list-style: none;
    padding: 16px 12px;
    flex: 1;
}

.nav-item { margin-bottom: 4px; }

.nav-button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: var(--radius);
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
}

.nav-button i {
    font-size: 20px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.nav-button:hover {
    background-color: var(--bg-body);
    color: var(--text-main);
}

.nav-button.active {
    background-color: var(--primary-soft);
    color: var(--primary);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid var(--border-color);
}

.logout-button {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    border-radius: var(--radius);
    transition: all 0.2s;
    text-decoration: none;
    font-size: 15px;
    white-space: nowrap;
}

.logout-button:hover {
    background-color: #fee2e2;
    color: #dc2626;
}

.logout-button i {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

/* ===================================
   MAIN CONTENT
   =================================== */

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Top Header */
.top-bar {
    height: var(--header-height);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.btn-icon-toggle {
    background: transparent;
    border: none;
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    margin-right: 16px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.btn-icon-toggle:hover {
    background-color: var(--bg-body);
    color: var(--primary);
}

.page-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-main);
}

.user-profile-summary {
    margin-left: auto;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

/* Content Wrapper */
.content-wrapper {
    padding: 24px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

/* ===================================
   PANELS & CARDS
   =================================== */

.tab-panel {
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.card {
    background: var(--bg-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin-bottom: 24px;
    min-height: 200px; /* Empty state height */
}

/* ===================================
   COLLAPSED SIDEBAR STATE
   =================================== */

body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .sidebar-header {
    padding: 0;
    justify-content: center;
}

body.sidebar-collapsed .logo-text {
    display: none;
}

body.sidebar-collapsed .logo-icon {
    font-size: 28px;
    margin: 0;
}

body.sidebar-collapsed .nav-button span,
body.sidebar-collapsed .logout-button span {
    display: none; /* Hide text */
}

body.sidebar-collapsed .nav-button,
body.sidebar-collapsed .logout-button {
    justify-content: center; /* Center icons */
    padding: 12px 0;
}

body.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

/* ===================================
   MOBILE STYLES
   =================================== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 100% !important; /* Full width on mobile when open */
    }
    
    body.sidebar-collapsed .sidebar {
        transform: translateX(0); /* "Collapsed" actually means OPEN on mobile logic inverted in JS? We'll handle via .mobile-view class usually */
    }
    
    /* Using a simpler approach for mobile: Sidebar hidden by default */
    .sidebar {
        left: -280px; 
    }
    
    body.sidebar-active .sidebar {
        left: 0;
        box-shadow: 0 0 100px rgba(0,0,0,0.5);
    }
    
    .main-content {
        margin-left: 0 !important;
    }
}

/* ===================================
   FORMS - THE FRESH LOOK
   =================================== */

/* Grid System for Form */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: 1fr 1fr; }

.form-group {
    margin-bottom: 24px;
    position: relative;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-main);
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid var(--border-color);
    border-radius: 8px; /* Slightly tighter radius than buttons */
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

/* Fresh Input Interaction */
.form-input:hover,
.form-select:hover,
.form-textarea:hover {
    border-color: #A0A0A0;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    color: var(--text-main);
    background-color: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.15); /* Soft Blue Glow */
    outline: 0;
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

/* File Input */
.form-file {
    padding: 10px;
    background: #FAFAFA;
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    width: 100%;
    cursor: pointer;
}
.form-file:hover { background: #F0F2F5; border-color: var(--primary); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    text-align: center;
    vertical-align: middle;
    user-select: none;
    padding: 0 24px;
    font-size: 15px;
    line-height: 1.5;
    border-radius: 20px; /* Pill shape */
    transition: all 0.2s;
    height: 48px;
    cursor: pointer;
    border: none;
    gap: 8px;
}

.btn-full { width: 100%; }

.btn-primary {
    background-color: var(--primary);
    color: #fff;
    box-shadow: 0 2px 4px rgba(24, 119, 242, 0.3);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(24, 119, 242, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Alerts */
.alert {
    position: relative;
    padding: 16px;
    margin-bottom: 24px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    color: #0f5132;
    background-color: #d1e7dd;
    border-color: #badbcc;
}

.alert-error {
    color: #842029;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}
.alert-info {
    color: #055160;
    background-color: #cff4fc;
    border-color: #b6effb;
}

/* Login Page Only */
.login-container {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #F0F2F5;
}
.login-card {
    background: #fff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}
.login-title {
    text-align: center;
    margin-bottom: 30px;
    color: var(--primary);
    font-size: 32px;
}

/* Utilities */
.hidden { display: none !important; }

/* Table Styles - Enhanced */
.table-container {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.table { width: 100%; border-collapse: collapse; }
.table th {
    background: #F7F8FA;
    padding: 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}
.table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}
.badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}
.badge-success { background: #E7F7EC; color: #36A420; }
.badge-error { background: #FFEBE8; color: #FA383E; }
