/* style.css - Modernized UI */
*, *::before, *::after {
    box-sizing: border-box;
}

:root {
    --bg-color: #0B0E14;
    --surface-color: #14171F;
    --surface-light: #1E232E;
    --primary-color: #10B981; /* Elegant emerald */
    --primary-dim: rgba(16, 185, 129, 0.15);
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --border-color: #262B36;
    --error: #EF4444;
    --transition-speed: 0.2s;
    --glass-blur: blur(12px);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

.container {
    width: 90%;
    max-width: 420px;
    background-color: var(--surface-color);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    border: 1px solid var(--border-color);
    
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* --- SIDEBAR LAYOUT --- */
.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100vw;
}

.sidebar {
    width: 260px;
    background-color: var(--surface-color);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    z-index: 1000;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h2 {
    font-size: 18px;
    margin: 0;
    letter-spacing: 1px;
    color: var(--primary-color);
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    gap: 6px;
    overflow-y: auto;
}

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

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background-color: var(--bg-color);
}

.top-header {
    padding: 20px 32px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 16px;
    background-color: var(--surface-color);
}

.top-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 500;
}

.content-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 32px 40px;
}

.mobile-only-btn {
    display: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 24px;
    padding: 4px;
}

.hidden {
    display: none !important;
}

h2, h3, h4, h5 {
    color: var(--text-primary);
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-top: 0;
}

h3 {
    font-size: 24px;
    margin-bottom: 24px;
}

/* --- BUTTONS --- */
button {
    background-color: var(--primary-color);
    color: #ffffff;
    border: none;
    padding: 10px 18px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    transition: all var(--transition-speed) ease;
    font-size: 14px;
    font-family: inherit;
}

button:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--primary-dim);
}

button:active {
    transform: translateY(0);
}

button.action-btn {
    background-color: var(--surface-light);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

button.action-btn:hover {
    background-color: var(--border-color);
    border-color: #3B4252;
    color: #fff;
}

button.delete-btn {
    background-color: transparent;
    border: 1px solid var(--error);
    color: var(--error);
}

button.delete-btn:hover {
    background-color: rgba(239, 68, 68, 0.1);
}

/* Action buttons inside tables should be smaller and inline */
td button {
    padding: 6px 12px;
    font-size: 13px;
    margin-right: 6px;
    margin-bottom: 0;
    display: inline-block;
}

td:last-child {
    white-space: nowrap;
}

.logout-btn {
    background-color: transparent;
    border: 1px solid var(--error);
    color: var(--error);
    padding: 8px 16px;
    width: 100%;
}

.icon-btn {
    background: transparent;
    border: none;
    font-size: 18px;
    padding: 4px;
    cursor: pointer;
    vertical-align: middle;
}
.icon-btn:hover {
    transform: scale(1.1);
    box-shadow: none;
}
.hidden-contact {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: monospace;
    font-size: 13px;
    background: rgba(0,0,0,0.2);
    padding: 4px 8px;
    border-radius: 6px;
}

/* --- NAV TABS --- */
nav {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.tab-btn {
    background-color: transparent;
    color: var(--text-secondary);
    border: 1px solid transparent;
    border-radius: 8px;
    text-align: left;
    padding: 12px 16px;
    width: 100%;
}

.tab-btn:hover {
    background-color: var(--surface-light);
    color: var(--text-primary);
    transform: none;
    box-shadow: none;
}

.tab-btn.active {
    background-color: var(--primary-dim);
    color: var(--primary-color);
    border-left: 3px solid var(--primary-color);
    box-shadow: none;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* --- BADGES & STATS --- */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.badge.hot {
    background: rgba(249, 115, 22, 0.15);
    color: #F97316;
    border: 1px solid rgba(249, 115, 22, 0.3);
}
.badge.active {
    background: rgba(16, 185, 129, 0.15);
    color: #10B981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.badge.inactive {
    background: rgba(148, 163, 184, 0.15);
    color: #94A3B8;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}
.stat-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.2);
    transition: transform 0.3s ease;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.3);
}
.stat-title {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 12px;
    font-weight: 500;
}
.stat-value {
    color: var(--text-primary);
    font-size: 32px;
    font-weight: 600;
}
.stat-value[style*="color: #00FF41;"], .stat-value[style*="color: rgb(0, 255, 65);"] {
    color: var(--primary-color) !important;
}
.stat-value[style*="color: var(--error);"] {
    color: var(--error) !important;
}

/* --- FORMS --- */
#exp-form-container, #user-form-container, #supplier-form-container, #booking-form-container {
    background-color: var(--surface-color);
    padding: 32px;
    border-radius: 16px;
    margin: 24px 0;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.form-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

input, select, textarea {
    width: 100%;
    padding: 12px 16px;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 8px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 14px;
    transition: all var(--transition-speed);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-dim);
}

textarea {
    height: 100px;
    resize: vertical;
}

/* --- TOGGLES --- */
.toggle-group {
    display: flex;
    gap: 32px;
    margin: 24px 0;
    flex-wrap: wrap;
}

.toggle-item {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toggle-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: .3s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .3s;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* --- ACTIONS --- */
.form-actions {
    display: flex;
    gap: 16px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.save-btn {
    flex: 1;
}

#cancel-exp-btn, #cancel-user-btn, #cancel-supplier-btn, #cancel-booking-btn {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}
#cancel-exp-btn:hover, #cancel-user-btn:hover, #cancel-supplier-btn:hover, #cancel-booking-btn:hover {
    background-color: var(--surface-light);
    color: var(--text-primary);
}

/* --- TABLES --- */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background-color: var(--surface-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

th, td {
    text-align: left;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

th {
    color: var(--text-secondary);
    background-color: rgba(0,0,0,0.15);
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

tr:hover td {
    background-color: rgba(255, 255, 255, 0.02);
}

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

/* --- Responsive --- */
@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        box-shadow: 4px 0 24px rgba(0,0,0,0.5);
    }

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

    .mobile-only-btn {
        display: block;
    }

    .content-scroll {
        padding: 24px 16px;
    }
}

@media (max-width: 600px) {
    .container {
        width: 90%;
        padding: 32px 20px;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-row .form-group {
        width: 100%;
    }

    .sticky-actions {
        position: sticky;
        bottom: 0;
        background-color: var(--surface-color);
        padding: 16px;
        margin: 24px -32px -32px -32px;
        border-top: 1px solid var(--border-color);
        z-index: 10;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.5);
    }
}

/* --- TOASTS --- */
#toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    background-color: var(--surface-light);
    color: var(--text-primary);
    padding: 16px 20px;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
    font-size: 14px;
    font-weight: 500;
    border-left: 4px solid var(--primary-color);
    opacity: 0;
    transform: translateX(100%);
    animation: slideIn 0.3s forwards, fadeOut 0.3s forwards 2.7s;
    pointer-events: all;
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast.error {
    border-left-color: var(--error);
}

@keyframes slideIn {
    to { opacity: 1; transform: translateX(0); }
}
@keyframes fadeOut {
    to { opacity: 0; transform: translateX(100%); }
}

/* --- MODAL FORMS --- */
#supplier-form-container,
#shop-form-container,
#exp-form-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#supplier-form-container.hidden,
#shop-form-container.hidden,
#exp-form-container.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

#supplier-form-container > h4,
#shop-form-container > h4,
#exp-form-container > h4 {
    background: var(--surface-color);
    width: 100%;
    max-width: 800px;
    padding: 24px 32px 12px 32px;
    margin-bottom: 0;
    border-radius: 12px 12px 0 0;
    border: 1px solid var(--border-color);
    border-bottom: none;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    transform: translateY(0);
    transition: transform 0.3s ease;
}

#supplier-form-container > form,
#shop-form-container > form,
#exp-form-container > form {
    background: var(--surface-color);
    width: 100%;
    max-width: 800px;
    max-height: calc(90vh - 80px);
    overflow-y: auto;
    padding: 0 32px 32px 32px;
    border-radius: 0 0 12px 12px;
    border: 1px solid var(--border-color);
    border-top: none;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    transform: translateY(0);
    transition: transform 0.3s ease;
}

#supplier-form-container.hidden > h4,
#shop-form-container.hidden > h4,
#exp-form-container.hidden > h4,
#supplier-form-container.hidden > form,
#shop-form-container.hidden > form,
#exp-form-container.hidden > form {
    transform: translateY(20px);
}
