:root {
    --primary-color: #2c3e50;
    --secondary-color: #34495e;
    --accent-color: #e74c3c;
    --text-color: #333;
    --bg-color: #ecf0f1;
    --white: #ffffff;
    --border-color: #bdc3c7;
    --success-color: #27ae60;
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.login-container {
    width: 100%;
    max-width: 400px;
    margin: 100px auto;
    background: var(--white);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.login-container h2 {
    margin-bottom: 20px;
    color: var(--primary-color);
}

.form-group {
    margin-bottom: 15px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 16px;
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 16px;
    transition: background 0.3s;
}

.btn:hover {
    background-color: var(--secondary-color);
}

.btn-danger {
    background-color: var(--accent-color);
}

.btn-success {
    background-color: var(--success-color);
}

.alert {
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 4px;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Dashboard Layout */
.app-container {
    display: flex;
    flex: 1;
}

.sidebar {
    width: 250px;
    background-color: var(--primary-color);
    color: var(--white);
    padding: 20px 0;
    flex-shrink: 0;
}

.sidebar-header {
    text-align: center;
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 20px 0;
}

.sidebar-nav li a {
    display: block;
    padding: 12px 20px;
    color: #bdc3c7;
    text-decoration: none;
    transition: all 0.3s;
}

.sidebar-nav li a:hover,
.sidebar-nav li a.active {
    background-color: var(--secondary-color);
    color: var(--white);
    border-left: 4px solid var(--accent-color);
}

.main-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.card {
    background: var(--white);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    padding: 20px;
    margin-bottom: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

table th,
table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

table th {
    background-color: #f8f9fa;
    font-weight: bold;
}

/* Invoice Form Specifics */
.invoice-items-table input {
    width: 100%;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

.d-flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

.align-center {
    align-items: center;
}

.gap-10 {
    gap: 10px;
}

.mb-20 {
    margin-bottom: 20px;
}

/* Responsive Media Queries */
@media (max-width: 768px) {

    /* 1. Stack Layout (Sidebar moves to top) */
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        padding: 10px;
    }

    .sidebar-nav {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 5px;
        margin: 10px 0;
    }

    .sidebar-nav li a {
        padding: 8px 12px;
        font-size: 14px;
        border-radius: 4px;
        border-right: none;
        /* Reset border */
    }

    /* 2. Responsive Tables (Horizontal Scroll) */
    .card {
        padding: 15px;
        /* Reduce padding */
        overflow-x: auto;
        /* Enable scroll for tables inside cards */
    }

    table {
        min-width: 600px;
        /* Force minimum width to trigger scroll */
    }

    /* 3. Stack Form Inputs */
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .header .btn {
        width: 100%;
        /* Full width buttons */
        text-align: center;
    }

    /* Force internal flex containers in forms to stack */
    .card>div[style*="display: flex"] {
        flex-direction: column !important;
    }

    .card>div>div[style*="flex: 1"] {
        flex: auto !important;
        width: 100%;
    }

    /* Adjust Invoice Form Inputs */
    .invoice-items-table input,
    .invoice-items-table select {
        font-size: 14px;
        /* Prevent zoom */
    }

    /* Hide non-essential columns on very small screens if needed, 
       but scrolling is usually better for data tables */
}