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

:root {
    --primary-color: #0066cc;
    --secondary-color: #f5f7fa;
    --accent-color: #d4a574;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --border-color: #e1e8ed;
    --sidebar-bg: #2c3e50;
    --sidebar-hover: #34495e;
    --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--secondary-color);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    height: 100vh;
    background-color: var(--sidebar-bg);
    padding: 20px 0;
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.logo {
    padding: 0 25px 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
}

.logo h2 {
    color: white;
    font-size: 24px;
    font-weight: 600;
}

.nav-menu {
    padding: 0 15px;
}

.nav-item, .nav-subitem {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 5px;
    transition: all 0.3s ease;
}

.nav-item:hover, .nav-subitem:hover {
    background-color: var(--sidebar-hover);
    color: white;
}

.nav-item.active {
    background-color: var(--accent-color);
    color: white;
}

.nav-item i, .nav-subitem i {
    width: 20px;
    margin-right: 12px;
    font-size: 16px;
}

.nav-section {
    margin: 10px 0;
}

.nav-section-title {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.nav-section-title:hover {
    background-color: var(--sidebar-hover);
    color: white;
}

.nav-section-title i:first-child {
    width: 20px;
    margin-right: 12px;
}

.nav-section-title span {
    flex: 1;
}

.toggle-icon {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.nav-section.expanded .toggle-icon {
    transform: rotate(180deg);
}

.nav-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding-left: 15px;
}

.nav-section.expanded .nav-submenu {
    max-height: 200px;
}

/* Main Content */
.main-content {
    margin-left: 260px;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* Normalize page containers inside main-content so layouts align consistently
   next to the fixed sidebar. Limits width for readability and centers content
   within the available main area. */
.main-content {
    padding: 30px 40px;
}

/* Left-align page containers so they start immediately after the
   fixed sidebar. This prevents a large centered gap and keeps
   search/top controls aligned to the left of content panels. */
.main-content > .dashboard-container,
.main-content > .finance-container,
.main-content > .legal-container,
.main-content > .warehouses-container,
.main-content > .users-container,
.main-content > .reservations-container,
.main-content > .properties-container {
    max-width: none;
    margin: 0;
    width: auto;
}

/* Make the topbar align with the centered page containers so
   header controls and content line up visually. */
.main-content .topbar {
    /* keep topbar full-width within main-content so controls align
       with the left edge of the content area */
    max-width: none;
    margin: 0 0 20px;
    width: 100%;
    box-sizing: border-box;
}

/* Top Bar */
.topbar {
    background: white;
    padding: 15px 30px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--card-shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-primary);
    cursor: pointer;
}

.search-bar {
    flex: 1;
    max-width: 500px;
    display: flex;
    align-items: center;
    background: var(--secondary-color);
    padding: 10px 15px;
    border-radius: 8px;
}

.search-bar i {
    color: var(--text-secondary);
    margin-right: 10px;
}

.search-bar input {
    border: none;
    background: none;
    outline: none;
    width: 100%;
    font-size: 14px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-left: auto;
}

.icon-btn {
    position: relative;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
}

.icon-btn .badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--danger-color);
    color: white;
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 10px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.user-name {
    font-weight: 500;
}

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

/* Dashboard Container */
.dashboard-container {
    padding: 30px;
}

.dashboard-header h1 {
    font-size: 32px;
    margin-bottom: 30px;
}

.highlight {
    color: var(--accent-color);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    position: relative;
    overflow: hidden;
}

.stat-header h3 {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.stat-footer {
    font-size: 13px;
    margin-bottom: 15px;
}

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.stat-change.positive {
    color: var(--success-color);
}

.stat-change.neutral {
    color: var(--text-secondary);
}

.stat-change.negative {
    color: var(--danger-color);
}

.stat-chart {
    height: 60px;
    margin-top: 15px;
}

/* Chart Container */
.chart-container {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    margin-bottom: 30px;
}

.chart-header {
    margin-bottom: 20px;
}

.chart-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.chart-content {
    height: 350px;
}

/* Content Grid */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 20px;
}

.content-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

/* Table Styles */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--secondary-color);
}

.data-table th {
    text-align: left;
    padding: 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.data-table td {
    padding: 15px 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.confirmed {
    background: #d4edda;
    color: #155724;
}

.status-badge.pending {
    background: #fff3cd;
    color: #856404;
}

.status-badge.checked-in {
    background: #d1ecf1;
    color: #0c5460;
}

/* Tasks List */
.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.task-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.task-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.task-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
    margin-top: 2px;
}

.task-checkbox.checked {
    background: var(--success-color);
    border-color: var(--success-color);
    position: relative;
}

.task-checkbox.checked::after {
    content: '✓';
    position: absolute;
    color: white;
    font-size: 14px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.task-content {
    flex: 1;
}

.task-title {
    font-weight: 500;
    margin-bottom: 5px;
    font-size: 14px;
}

.task-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 12px;
    color: var(--text-secondary);
}

.task-priority {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.task-priority.high {
    background: #fee;
    color: var(--danger-color);
}

.task-priority.medium {
    background: #fff3cd;
    color: var(--warning-color);
}

.task-priority.low {
    background: #d1ecf1;
    color: var(--primary-color);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
}

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

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

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

    .menu-toggle {
        display: block;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }

    .dashboard-container {
        padding: 20px;
    }

    .topbar {
        padding: 15px 20px;
    }

    .user-name {
        display: none;
    }
}

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

    .dashboard-header h1 {
        font-size: 24px;
    }

    .search-bar {
        display: none;
    }
}

/* Scrollbar Styling */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}
