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

:root {
    --primary: rgb(239, 59, 38);
    --primary-dark: rgb(200, 45, 28);
    --text: #222;
    --text-light: #666;
    --border: #ccc;
    --bg-light: #f5f5f5;
    --bg-white: #fff;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #17a2b8;
}

body {
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg-light);
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
}

.login-box {
    background: var(--bg-white);
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo h2 {
    color: var(--primary);
    font-size: 1.5em;
    margin-top: 10px;
}

.login-logo span {
    color: var(--text-light);
    font-size: 0.9em;
}

/* App Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background: #2c3e50;
    color: #fff;
    flex-shrink: 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    background: var(--primary);
    text-align: center;
}

.sidebar-header h2 {
    font-size: 1.1em;
    margin-bottom: 5px;
}

.sidebar-header span {
    font-size: 0.8em;
    opacity: 0.8;
}

.sidebar-nav {
    padding: 20px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #ecf0f1;
    text-decoration: none;
    transition: background 0.2s;
}

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

.nav-item.active {
    background: rgba(255,255,255,0.15);
    border-left: 3px solid var(--primary);
}

.nav-icon {
    width: 20px;
    margin-right: 12px;
    text-align: center;
}

.main-content {
    flex: 1;
    padding: 30px;
    margin-left: 250px;
    overflow-y: auto;
}

.page-header {
    margin-bottom: 30px;
}

.page-header h1 {
    color: var(--primary);
    font-size: 1.5em;
    margin-bottom: 5px;
}

.page-header p {
    color: var(--text-light);
}

/* Cards */
.card {
    background: var(--bg-white);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.card-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 500;
}

.card-body {
    padding: 20px;
}

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

.stat-card {
    background: var(--bg-white);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-left: 4px solid var(--info);
}

.stat-card.warning {
    border-left-color: var(--warning);
}

.stat-card.success {
    border-left-color: var(--success);
}

.stat-card.info {
    border-left-color: var(--info);
}

.stat-card.danger {
    border-left-color: var(--danger);
}

.stat-value {
    font-size: 2em;
    font-weight: 700;
    color: var(--text);
}

.stat-label {
    color: var(--text-light);
    font-size: 0.9em;
    margin-top: 5px;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
}

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

.table th {
    background: var(--bg-light);
    font-weight: 500;
    color: var(--text-light);
    font-size: 0.85em;
    text-transform: uppercase;
}

.table tr:hover {
    background: #fafafa;
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, opacity 0.2s;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn-secondary {
    background: #6c757d;
    color: #fff;
}

.btn-secondary:hover:not(:disabled) {
    background: #5a6268;
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-success:hover:not(:disabled) {
    background: #218838;
}

.btn-warning {
    background: #d69e2e;
    color: #fff;
}

.btn-warning:hover:not(:disabled) {
    background: #b7791f;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover:not(:disabled) {
    background: #c82333;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

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

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

.form-input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    transition: border-color 0.2s;
}

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

/* Alerts */
.alert {
    padding: 12px 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    transition: opacity 0.3s;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

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

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

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

/* Progress bar */
.progress {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s;
}

.progress-bar.warning {
    background: var(--warning);
}

.progress-bar.danger {
    background: var(--danger);
}

/* Log viewer */
.log-viewer {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 15px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    max-height: 300px;
    overflow-y: auto;
}

.log-line {
    padding: 2px 0;
}

.log-time {
    color: #6a9955;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 0;
    border-radius: 8px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #ccc;
}

.modal-header h3 {
    margin: 0;
    color: var(--primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.modal-close:hover {
    color: #333;
}

.modal form {
    padding: 20px;
}

/* Spinner */
.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.spinner-dark {
    border-color: rgba(0,0,0,0.15);
    border-top-color: #666;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Utility classes */
.text-muted {
    color: var(--text-light);
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.mb-3 {
    margin-bottom: 20px;
}

.d-flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

.align-center {
    align-items: center;
}

.gap-2 {
    gap: 10px;
}

/* Mobile nav bar */
.mobile-nav {
    display: none;
}

/* Responsive - mobile & tablet: hide sidebar, show bottom nav */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .main-content {
        margin-left: 0;
        padding: 15px;
        padding-bottom: 70px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 10px;
    }

    .modal-content {
        max-width: 100%;
        margin: 10px;
    }

    .table th,
    .table td {
        padding: 8px 10px;
        font-size: 0.85em;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #2c3e50;
        z-index: 900;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        height: 56px;
        box-shadow: 0 -2px 8px rgba(0,0,0,0.2);
    }

    .mobile-nav::-webkit-scrollbar {
        display: none;
    }

    .mobile-nav a {
        color: #c8d6e0;
        text-decoration: none;
        font-size: 18px;
        min-width: 64px;
        padding: 6px 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        flex-shrink: 0;
    }

    .mobile-nav a span.mobile-nav-label {
        font-size: 9px;
        white-space: nowrap;
    }

    .mobile-nav a.active {
        color: #fff;
        background: rgba(255,255,255,0.1);
        border-radius: 6px;
    }

    /* Fade hints to indicate scrollable content */
    .mobile-nav-wrap {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 899;
        height: 56px;
        pointer-events: none;
    }

    .mobile-nav-wrap::before,
    .mobile-nav-wrap::after {
        content: '';
        position: absolute;
        top: 0;
        bottom: 0;
        width: 20px;
        z-index: 901;
        pointer-events: none;
    }

    .mobile-nav-wrap::before {
        left: 0;
        background: linear-gradient(to right, #2c3e50, transparent);
    }

    .mobile-nav-wrap::after {
        right: 0;
        background: linear-gradient(to left, #2c3e50, transparent);
    }
}
