/* ==================================== */
/* General Styles */
/* ==================================== */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    color: #333;
}
.container {
    width: 80%;
    margin: auto;
    overflow: hidden;
    padding: 20px;
}
header {
    background: #50b3a2;
    color: white;
    padding-top: 30px;
    min-height: 70px;
    border-bottom: #e8491d 3px solid;
    text-align: center;
}
header h1 {
    margin: 0;
    padding-bottom: 10px;
}
header a {
    color: #ffffff;
    text-decoration: none;
    text-transform: uppercase;
    font-size: 16px;
}
header nav ul {
    padding: 0;
    list-style: none;
    display: inline-block;
    margin: 0;
}
header nav li {
    display: inline;
    padding: 0 15px 0 15px;
}
.main-content {
    padding: 20px;
    text-align: center;
}
.two-column-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start; /* Aligns columns at the top */
}
.column {
    flex: 1;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
    display: flex; /* Makes the column a flex container */
    flex-direction: column; /* Stacks its children vertically */
}
.column h3 {
    color: #50b3a2;
    text-align: center;
    margin-top: 0; /* Remove default top margin to align with button */
}
.form-section {
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.form-section h2, .form-section h3 {
    color: #50b3a2;
    text-align: center;
}
.form-section p {
    text-align: center;
    color: #555;
}

/* ==================================== */
/* Form Elements */
/* ==================================== */
.form-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
}
.form-row label {
    font-weight: bold;
    margin-bottom: 5px;
}
.form-row input[type="text"],
.form-row input[type="date"],
.form-row input[type="email"],
.form-row input[type="tel"],
.form-row input[type="number"],
.form-row input[type="password"],
.form-row select,
.form-row textarea {
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 4px;
}
#new-client-fields .form-row {
    margin-bottom: 5px;
}
#new-client-fields .form-row input {
    margin-bottom: 10px;
}
.item-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}
.item-row select, .item-row input {
    flex: 1;
}
.item-row input[name*="quantity"] {
    flex: 0.5;
}
.item-row .price, .item-row .total {
    flex: 0.5;
}
.remove-item {
    cursor: pointer;
    color: #e8491d;
    font-weight: bold;
    font-size: 1.2em;
}
.total-section {
    margin-top: 20px;
    text-align: right;
    font-size: 1.2em;
    font-weight: bold;
}
.submit-btn {
    display: block;
    width: 100%;
    padding: 15px;
    background-color: #333;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 18px;
    cursor: pointer;
    margin-top: 20px;
}
.submit-btn:hover {
    background-color: #50b3a2;
}

/* ==================================== */
/* Table & List Styles */
/* ==================================== */
.table-container {
    flex-grow: 1; /* This is the key change */
    margin-bottom: 20px; /* Add margin to create space before the button */
}
.data-table {
    width: 100%;
    text-align: left;
    border-collapse: collapse;
}
.data-table thead th {
    padding: 10px;
    border-bottom: 2px solid #333;
}
.data-table tbody td {
    padding: 10px;
    border-bottom: 1px solid #ccc;
}
.data-table tr {
    transition: background-color 0.3s ease;
}
.no-results {
    text-align: center;
    padding: 20px;
}
.action-link {
    color: #50b3a2;
    text-decoration: none;
}
.delete-link {
    color: #e8491d;
}

/* Table Row Colors based on Status */
.color-draft { background-color: rgba(255, 153, 153, 0.5); }
.color-sent { background-color: rgba(255, 204, 0, 0.5); }
.color-paid, .color-accepted, .color-converted { background-color: rgba(153, 255, 153, 0.5); }
.color-overdue, .color-rejected { background-color: rgba(255, 153, 153, 0.5); }

/* ==================================== */
/* Buttons */
/* ==================================== */
.btn {
    background: #333;
    color: #fff;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 5px;
    border: none;
    cursor: pointer;
}
.btn:hover {
    background: #50b3a2;
}
.delete-btn {
    background-color: #e8491d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    margin-top: 20px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}
.dashboard-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.dashboard-controls .btn {
    margin: 0;
}
.bulk-actions-group {
    display: flex;
    gap: 10px;
}
.bulk-actions-group .btn {
    padding: 8px 12px;
    font-size: 14px;
    white-space: nowrap;
}
.button-group-end {
    margin-left: auto;
    display: flex;
    gap: 10px;
}
.home-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
}
/* ==================================== */
/* Print and Responsive Styles */
/* ==================================== */
@media (max-width: 768px) {
    .container {
        width: 85%;
    }
    header h1 {
        font-size: 1.5em;
    }
    .two-column-layout {
        flex-direction: column;
        gap: 20px;
        width: 100%;
    }
    .column {
        width: 100%;
        margin-bottom: 20px;
        padding: 10px;
    }
    .item-row {
        flex-wrap: wrap;
    }
    .item-row select,
    .item-row input {
        flex-basis: 100%;
        margin-bottom: 10px;
    }
    .item-row input[name*="quantity"],
    .item-row .price,
    .item-row .total {
        flex-basis: calc(50% - 5px);
    }
    .dashboard-controls {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    /* Mobile button styles */
    .dashboard-controls .btn,
    .home-actions .btn {
        width: 100%;
        margin-bottom: 10px;
        padding: 10px;
    }
    .bulk-actions-group {
        width: 100%;
        display: flex;
        justify-content: center;
        gap: 10px;
    }
    .bulk-actions-group .btn {
        flex: 1;
        text-align: center;
        padding: 8px 10px;
        font-size: 12px;
        max-width: 45%;
    }
    .home-actions {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }
    .home-actions .btn {
        flex: 1 1 45%;
        text-align: center;
        margin-bottom: 0;
    }
    .left-controls-group {
        width: 100%;
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }
    .left-controls-group .btn {
        flex: 1 1 auto;
        min-width: 40%;
        text-align: center;
        margin-bottom: 0;
    }
    .archive-button-container {
        text-align: center;
        width: 100%;
    }
    .archive-button-container .btn {
        display: block;
        width: auto;
        margin: 10px auto;
    }
    /* Mobile Table Styles */
    .data-table thead, .data-table tbody, .data-table th, .data-table td, .data-table tr {
        display: block;
    }
    .data-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    .data-table tr {
        border: 1px solid #ccc;
        margin-bottom: 10px;
    }
    .data-table td {
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 50%;
        text-align: right;
    }
    .data-table td:before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 45%;
        padding-left: 10px;
        font-weight: bold;
        text-align: left;
    }
    /* Action Links on Mobile */
    .data-table td:last-child {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: flex-end;
        text-align: right;
        gap: 5px;
    }
    .data-table td:last-child a {
        margin-bottom: 0;
        font-size: 14px;
    }
}
@media print {
    header,
    .btn,
    .main-content {
        display: none;
    }
    .form-section {
        box-shadow: none;
    }
}