:root {
    --bg-color: #f4f7fb;
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --sidebar-active: #2563eb;
    --text-main: #334155;
    --text-light: #94a3b8;
    --white: #ffffff;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --border: #e2e8f0;
    --success: #10b981;
    --danger: #ef4444;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow-x: hidden;
}

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

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: var(--sidebar-bg);
    color: var(--white);
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.logo {
    padding: 24px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo h2 {
    font-size: 1.25rem;
}

.nav-links {
    list-style: none;
    margin-top: 20px;
    display: flex;
    flex-direction: column;
}

.nav-links li {
    padding: 16px 24px;
    cursor: pointer;
    transition: background 0.2s;
    font-weight: 500;
}

.nav-links li:hover {
    background-color: var(--sidebar-hover);
}

.nav-links li.active {
    background-color: var(--sidebar-active);
    border-left: 4px solid var(--white);
}

/* Main Content */
.content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    padding-bottom: 80px; /* Extra padding for mobile bottom nav */
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

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

header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-direction: row;
    margin-bottom: 30px;
    gap: 15px;
}

header h1 {
    font-size: 24px;
    color: #0f172a;
}

header p {
    color: var(--text-light);
    margin-top: 5px;
    font-size: 14px;
}

/* Cards & Forms */
.card {
    background: var(--white);
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    margin-bottom: 24px;
}

.hidden {
    display: none;
}

.form-group {
    margin-bottom: 16px;
    flex: 1;
}

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

label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #475569;
}

input, select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Buttons */
.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-block;
    text-align: center;
}

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

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

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

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
}

.btn-outline:hover {
    background-color: #f8fafc;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* Tables */
.table-container {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    overflow-x: auto;
}

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

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

th {
    background-color: #f8fafc;
    font-weight: 600;
    font-size: 13px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

td {
    font-size: 14px;
}

tbody tr:hover {
    background-color: #f8fafc;
}

.badge {
    padding: 4px 8px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 600;
}

.badge-low {
    background-color: #fee2e2;
    color: #b91c1c;
}
.badge-ok {
    background-color: #d1fae5;
    color: #047857;
}

/* Messages */
.msg {
    margin-top: 12px;
    font-size: 14px;
    font-weight: 500;
}
.msg.success { color: var(--success); }
.msg.error { color: var(--danger); }

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

/* Responsive Design for Mobile */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        position: fixed;
        bottom: 0;
        left: 0;
        flex-direction: row;
        justify-content: space-around;
        align-items: center;
        background-color: var(--white);
        border-top: 1px solid var(--border);
        box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    }
    
    .logo {
        display: none; /* Hide logo on mobile to make room for tabs */
    }
    
    .nav-links {
        margin: 0;
        width: 100%;
        flex-direction: row;
        justify-content: space-around;
    }
    
    .nav-links li {
        flex: 1;
        text-align: center;
        padding: 16px 0;
        color: var(--text-light);
        border: none !important;
        font-size: 13px;
    }
    
    .nav-links li.active {
        background-color: transparent;
        color: var(--primary);
        border-top: 3px solid var(--primary) !important;
        border-left: none !important;
    }

    .content {
        padding: 20px;
        padding-bottom: 90px;
    }
    
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .btn {
        width: 100%;
    }
    
    .form-actions {
        flex-direction: column;
    }
}
