:root {
    --bg-base: #f4f7fb;
    --bg-surface: #ffffff;
    --bg-sidebar: #f4f7fb;
    
    --primary: #0a192f;
    --primary-hover: #172a45;
    --secondary: #e2e8f0;
    
    --text-main: #1e293b;
    --text-muted: #64748b;
    
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    
    --success: #10b981;
    --success-bg: #d1fae5;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    --danger: #ef4444;
    --danger-bg: #fee2e2;
    --card-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.5);
    --sidebar-width: 280px;
    --radius: 12px;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-base);
    color: var(--text-main);
    line-height: 1.6;
}

.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px 0;
}

.logo {
    padding: 0 24px 32px;
}

.logo h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}

.logo p {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.logo-icon {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.sidebar nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 16px;
}

.nav-item {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-item i {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.nav-item:hover {
    background-color: var(--secondary);
    color: var(--text-main);
}

.nav-item.active {
    background-color: var(--primary);
    color: #ffffff;
}

.sidebar-footer {
    padding: 24px;
    border-top: 1px solid var(--border);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-profile img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.user-profile .name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-main);
}

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

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--bg-surface);
}

header {
    height: 72px;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background-color: var(--bg-surface);
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: var(--bg-base);
    padding: 10px 16px;
    border-radius: 8px;
    width: 300px;
    border: 1px solid var(--border);
}

.search-bar input {
    background: transparent;
    border: none;
    color: var(--text-main);
    width: 100%;
    outline: none;
    font-family: inherit;
}

.search-bar input::placeholder {
    color: var(--text-muted);
}

.search-bar i {
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    transition: color 0.2s;
    position: relative;
}

.icon-btn:hover {
    color: var(--text-main);
}

/* Content Area */
.content-area {
    padding: 32px;
    flex: 1;
    overflow-y: auto;
    background-color: var(--bg-base);
}

.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-pane.active {
    display: block;
}

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

/* Dashboard Specific */
.welcome-banner {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius);
    padding: 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    box-shadow: var(--card-shadow);
    position: relative;
    overflow: hidden;
}

.welcome-banner::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    border-radius: 50%;
}

.welcome-text h2 {
    font-size: 28px;
    margin-bottom: 8px;
    font-weight: 700;
}

.welcome-text p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 16px;
    max-width: 500px;
}

.welcome-image {
    font-size: 80px;
    color: rgba(255, 255, 255, 0.2);
    position: absolute;
    right: 40px;
    transform: rotate(15deg);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background-color: var(--bg-base);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--primary);
}

.stat-card:nth-child(2) .stat-icon {
    background-color: rgba(14, 165, 233, 0.1);
    color: var(--secondary);
}

.stat-card:nth-child(3) .stat-icon {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.stat-info h3 {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.stat-info p {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-main);
}

/* Common Section Styles */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.section-header h2 {
    font-size: 24px;
    font-weight: 600;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: var(--bg-base);
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background-color: var(--secondary);
}

/* Cards & Tables */
.card {
    background-color: var(--bg-surface);
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    color: var(--text-muted);
    text-align: center;
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 20px;
    color: var(--text-main);
    margin-bottom: 8px;
}

/* Excel Table */
.table-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--border);
}

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

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background-color: var(--bg-base);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    font-size: 14px;
    color: var(--text-main);
}

tr:hover td {
    background-color: var(--bg-base);
}

/* PDF Viewer */
.pdf-viewer-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: 100%;
}

.pdf-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    background-color: rgba(0,0,0,0.2);
    padding: 12px 24px;
    border-radius: 20px;
}

.page-info {
    font-weight: 500;
}

#pdf-canvas {
    border: 1px solid var(--border);
    border-radius: 8px;
    max-width: 100%;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    background-color: white; /* PDF content needs white bg */
}

/* Form Styles */
.form-input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 6px;
    background: #ffffff;
    border: 1px solid var(--border);
    color: var(--text-main);
    margin-bottom: 12px;
    font-family: inherit;
    font-size: 14px;
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-success { background-color: var(--success-bg); color: #065f46; }
.badge-warning { background-color: var(--warning-bg); color: #92400e; }
.badge-danger { background-color: var(--danger-bg); color: #991b1b; }

/* Dashboard layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

/* Wizard Layouts */
.wizard-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Sidebar toggle */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-main);
    cursor: pointer;
    margin-right: 16px;
}

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

/* Responsive */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }
    
    .sidebar-overlay.open {
        display: block;
    }

    header {
        padding: 0 16px;
    }

    .sidebar {
        position: fixed;
        left: -100%;
        height: 100%;
        z-index: 100;
        transition: left 0.3s ease;
        box-shadow: 4px 0 10px rgba(0,0,0,0.1);
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .search-bar {
        width: 200px;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    /* Wizard Responsive overrides */
    .wizard-grid-2 {
        grid-template-columns: 1fr;
    }

    .wizard-nav-container {
        overflow-x: auto;
        white-space: nowrap;
    }

    .wizard-nav-step {
        font-size: 13px;
        padding: 12px !important;
        min-width: max-content;
    }

    .wizard-actions {
        flex-direction: column;
        gap: 12px;
    }

    .wizard-actions button {
        width: 100%;
    }

    .wizard-actions-right {
        display: flex;
        flex-direction: column;
        gap: 12px;
        width: 100%;
    }
    
    .wizard-actions-right button {
        margin: 0 !important;
    }

    /* Responsive Pest Details Table */
    #table-pest-details thead, #table-recommendations thead {
        display: none;
    }
    
    #table-pest-details tbody tr, #table-recommendations tbody tr {
        display: block;
        border: 1px solid var(--border);
        margin-bottom: 16px;
        padding: 12px;
        border-radius: 8px;
        position: relative;
        background-color: var(--bg-surface);
    }
    
    #table-pest-details tbody td, #table-recommendations tbody td {
        display: block;
        padding: 0 0 12px 0;
        border: none;
    }

    #table-pest-details tbody td:last-child, #table-recommendations tbody td:last-child {
        padding-bottom: 0;
    }
    
    #table-pest-details tbody td::before, #table-recommendations tbody td::before {
        content: attr(data-label);
        display: block;
        font-size: 12px;
        color: var(--text-muted);
        font-weight: 600;
        margin-bottom: 4px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    #table-pest-details tbody td[data-label="Action"] {
        position: absolute;
        top: 12px;
        right: 12px;
        padding: 0;
    }
    
    #table-pest-details tbody td[data-label="Action"]::before {
        display: none;
    }
}
