/* ============================================
   SAFARI SEEDS - LAYOUT & PAGE COMPONENTS
   Based on Figma Design Specification v1.0
   ============================================ */

/* Global Inputs styling to remove number scroll arrows */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    appearance: textfield;
    -moz-appearance: textfield;
}

/* ============================================
   SIDEBAR NAVIGATION
   ============================================ */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--dark-primary);
    color: var(--dark-text);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width var(--transition-slow) ease-in-out;
    overflow: hidden;
}

/* Sidebar Header */
.sidebar-header {
    height: 80px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--dark-border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo {
    width: 60px;
    height: 60px;
    background: #ffffff;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.sidebar-brand {
    flex: 1;
    min-width: 0;
}

.sidebar-brand h1 {
    font-size: 18px;
    font-weight: 700;
    color: var(--white);
    margin: 0;
    white-space: nowrap;
}

.sidebar-brand p {
    font-size: 11px;
    color: var(--dark-text-muted);
    margin: 0;
    white-space: nowrap;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: var(--space-2) 0;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: var(--space-4);
}

.nav-section-title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--dark-text-muted);
    padding: 8px 24px;
    margin: 0;
}

.nav-item {
    display: block;
    margin: 2px 12px;
    border-radius: var(--radius-lg);
    transition: all var(--transition-normal) ease;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 12px;
    color: var(--dark-text-muted);
    font-size: 14px;
    font-weight: 400;
    text-decoration: none;
    transition: color var(--transition-fast);
}

.nav-item a svg,
.nav-item a i {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.nav-item:hover a {
    color: var(--white);
}

.nav-item.active {
    background: var(--primary-500);
}

.nav-item.active a {
    color: var(--white);
    font-weight: 500;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--dark-border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-footer .avatar {
    flex-shrink: 0;
}

.sidebar-footer .user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-footer .user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-footer .user-role {
    font-size: 12px;
    color: var(--dark-text-muted);
}

/* Sidebar Toggle Button - Hidden to fix floating arrow glitch */
.sidebar-toggle {
    display: none;
    position: absolute;
    right: -14px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    background: var(--primary-500);
    border: none;
    border-radius: 50%;
    color: var(--white);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
    z-index: 10;
}

.sidebar-toggle:hover {
    background: var(--primary-600);
    transform: translateY(-50%) scale(1.1);
}

.sidebar-toggle svg {
    width: 16px;
    height: 16px;
    transition: transform var(--transition-normal);
}

/* Collapsed Sidebar */
.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar.collapsed .sidebar-brand,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .sidebar-footer .user-info {
    display: none;
}

.sidebar.collapsed .nav-item a {
    justify-content: center;
    padding: 12px;
}

.sidebar.collapsed .sidebar-toggle svg {
    transform: rotate(180deg);
}

/* ============================================
   TOP HEADER
   ============================================ */

.header {
    height: var(--header-height);
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 0 var(--space-6);
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.header-toggle {
    width: 40px;
    height: 40px;
    display: none;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--gray-700);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.header-toggle:hover {
    background: var(--gray-100);
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 14px;
}

.breadcrumb-item {
    color: var(--gray-600);
}

.breadcrumb-item a {
    color: var(--gray-600);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.breadcrumb-item a:hover {
    color: var(--primary-500);
}

.breadcrumb-separator {
    color: var(--gray-400);
}

.breadcrumb-item.active {
    color: var(--gray-900);
    font-weight: 500;
}

/* Header Right */
.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

/* Search Input */
.header-search {
    position: relative;
    width: 280px;
}

.header-search input {
    width: 100%;
    height: 40px;
    padding: 8px 12px 8px 40px;
    background: var(--gray-100);
    border: none;
    border-radius: var(--radius-lg);
    font-size: 14px;
}

.header-search input:focus {
    background: var(--white);
    box-shadow: 0 0 0 2px var(--primary-100);
}

.header-search .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    width: 18px;
    height: 18px;
}

/* Search Results Dropdown */
.search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 8px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--gray-200);
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background var(--transition-fast);
    border-bottom: 1px solid var(--gray-100);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--gray-50);
}

.search-result-icon {
    font-size: 20px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.search-result-content {
    flex: 1;
    min-width: 0;
}

.search-result-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-detail {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 2px;
}

.search-no-results {
    padding: 24px 16px;
    text-align: center;
    color: var(--gray-500);
    font-size: 14px;
}

/* Notification Bell */
.notification-btn {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--gray-600);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.notification-btn:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

.notification-btn .badge-count {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--danger);
    color: var(--white);
    font-size: 10px;
    font-weight: 600;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* User Dropdown */
.user-dropdown {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 6px 12px 6px 6px;
    background: var(--gray-50);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.user-dropdown:hover {
    background: var(--gray-100);
}

.user-dropdown .user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-900);
}

.user-dropdown .chevron {
    width: 16px;
    height: 16px;
    color: var(--gray-500);
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */

.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    background: var(--gray-50);
    transition: margin-left var(--transition-slow) ease-in-out;
}

.sidebar.collapsed~.main-content,
.main-content.expanded {
    margin-left: var(--sidebar-collapsed);
}

.page-content {
    padding: var(--space-6);
}

/* Page Header */
.page-header {
    margin-bottom: var(--space-6);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.page-header-left {
    flex: 1;
}

.page-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0 0 var(--space-1) 0;
}

.page-subtitle {
    font-size: 14px;
    color: var(--gray-600);
    margin: 0;
}

.page-header-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* ============================================
   LOGIN PAGE - SPLIT SCREEN
   ============================================ */

.login-page {
    display: flex;
    min-height: 100vh;
}

.login-left {
    flex: 1;
    background: linear-gradient(135deg, var(--primary-700) 0%, var(--primary-500) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-12);
    position: relative;
    overflow: hidden;
}

.login-left::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
}

.login-left .brand-logo {
    width: 80px;
    height: 80px;
    background: var(--white);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-4);
    position: relative;
    z-index: 1;
}

.login-left .brand-logo svg {
    width: 48px;
    height: 48px;
    color: var(--primary-500);
}

.login-left .brand-name {
    font-size: 36px;
    font-weight: 700;
    color: var(--white);
    margin-bottom: var(--space-2);
    position: relative;
    z-index: 1;
}

.login-left .brand-tagline {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: var(--space-10);
    position: relative;
    z-index: 1;
}

.login-features {
    position: relative;
    z-index: 1;
}

.login-feature {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.login-feature svg {
    width: 24px;
    height: 24px;
    color: var(--white);
}

.login-feature span {
    font-size: 14px;
    color: var(--white);
}

.login-right {
    flex: 1;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-12);
}

.login-form-container {
    width: 100%;
    max-width: 400px;
}

.login-heading {
    font-size: 30px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: var(--space-2);
}

.login-subtext {
    font-size: 14px;
    color: var(--gray-600);
    margin-bottom: var(--space-8);
}

.login-form .form-group {
    margin-bottom: var(--space-5);
}

.login-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-6);
}

.login-options .forgot-link {
    font-size: 14px;
    color: var(--primary-500);
    text-decoration: none;
    font-weight: 500;
}

.login-options .forgot-link:hover {
    text-decoration: underline;
}

.login-btn {
    width: 100%;
    height: 48px;
    font-size: 16px;
}

.login-footer {
    text-align: center;
    margin-top: var(--space-6);
}

.login-footer .version {
    font-size: 12px;
    color: var(--gray-400);
}

/* Login Error Banner */
.login-error {
    background: var(--danger-light);
    border-left: 4px solid var(--danger);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-5);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.login-error svg {
    width: 20px;
    height: 20px;
    color: var(--danger);
    flex-shrink: 0;
}

.login-error span {
    font-size: 14px;
    color: var(--danger);
}

/* ============================================
   DASHBOARD STATS GRID
   ============================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-6);
    margin-bottom: var(--space-6);
}

@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* DISABLED: Voucher forms need to maintain grid layout */
/*
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}
*/

/* ============================================
   CHARTS GRID
   ============================================ */

.charts-grid {
    display: grid;
    grid-template-columns: 60% 40%;
    gap: var(--space-6);
    margin-bottom: var(--space-6);
}

@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   TABLES GRID
   ============================================ */

.tables-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-6);
}

@media (max-width: 1024px) {
    .tables-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   QUICK ACTIONS GRID
   ============================================ */

.quick-actions {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.quick-action-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-sm);
}

.quick-action-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.quick-action-card .icon {
    width: 48px;
    height: 48px;
    margin: 0 auto var(--space-3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quick-action-card .icon svg {
    width: 24px;
    height: 24px;
}

.quick-action-card .label {
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
}

@media (max-width: 1200px) {
    .quick-actions {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   FILTER TABS
   ============================================ */

.filter-tabs {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-6);
}

.filter-tab {
    padding: 8px 16px;
    background: var(--gray-100);
    border: none;
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.filter-tab:hover {
    background: var(--gray-200);
}

.filter-tab.active {
    background: var(--primary-500);
    color: var(--white);
}

/* ============================================
   TABLE TOOLBAR
   ============================================ */

.table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--gray-100);
}

.table-toolbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.table-search {
    position: relative;
    width: 300px;
}

.table-search input {
    width: 100%;
    height: 40px;
    padding: 8px 12px 8px 40px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-lg);
    font-size: 14px;
}

.table-search .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    width: 18px;
    height: 18px;
}

.table-filter {
    height: 40px;
    min-width: 150px;
}

.table-toolbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1023px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .header-toggle {
        display: flex;
    }

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

    .sidebar.open~.sidebar-overlay {
        display: block;
    }

    .login-left {
        display: none;
    }

    .login-right {
        padding: var(--space-6);
    }
}

@media (max-width: 767px) {
    .page-content {
        padding: var(--space-4);
    }

    .page-header {
        flex-direction: column;
        gap: var(--space-4);
    }

    .page-header-right {
        width: 100%;
    }

    .page-header-right .btn {
        flex: 1;
    }

    .header-search {
        display: none;
    }
}

/* ============================================
   MODAL COMPONENT
   ============================================ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1050;
    /* Higher than sidebar (100) and header (50) */
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
    transition: all 0.3s ease;
    opacity: 0;
}

.modal.active {
    display: flex;
    opacity: 1;
}

/* Ensure modal content is scrollable if too tall */
.modal-content {
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    background: var(--white);
    /* Ensure background is set */
}