/* c:\wamp64\www\mssql\css\style.css */
:root {
    --primary: #007bff;
    --success: #28a745;
    --danger: #dc3545;
    --light: #f8f9fa;
    --dark: #343a40;
    --border: #dee2e6;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f4f6f9;
    margin: 0;
    padding: 15px;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

h2 {
    margin-top: 0;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 10px;
    color: var(--dark);
}

/* Form Sections */
.section {
    margin-bottom: 25px;
    padding: 15px;
    background-color: var(--light);
    border-radius: 5px;
    border: 1px solid var(--border);
}

.section-title {
    font-weight: bold;
    margin-bottom: 15px;
    display: block;
    color: var(--primary);
}

.grid-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

label {
    margin-bottom: 5px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
}

input, select {
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px; /* Prevent iOS zoom */
    width: 100%;
    box-sizing: border-box; /* Fixes padding issues */
}

input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

/* Table Styles */
.table-responsive {
    overflow-x: auto;
    margin-bottom: 15px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: white;
    padding-bottom: 10px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 8px;
    border: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

th {
    background-color: #e9ecef;
    position: sticky;
    top: 0;
    z-index: 10;
    font-size: 0.85rem;
}

/* Specific style for the estimate grid to keep scrolling behavior */
#gridTable {
    min-width: 600px;
}

/* Professional Summary Table Styles */
.summary-table th {
    background-color: var(--primary);
    color: white;
    padding: 12px;
}

.summary-table td {
    padding: 10px 12px;
}

.summary-table tr:nth-child(even) {
    background-color: #f8f9fa;
}

.summary-table tr:hover {
    background-color: #e9ecef;
}

.summary-table td.numeric {
    text-align: right;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-variant-numeric: tabular-nums;
}

td input {
    border: 1px solid #ddd;
    padding: 6px;
    font-size: 0.9rem;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: opacity 0.2s;
}

.btn:hover { opacity: 0.9; }
.btn-primary { background-color: var(--primary); color: white; }
.btn-success { background-color: var(--success); color: white; width: 100%; font-size: 1.1rem; margin-top: 10px;}
.btn-danger { background-color: var(--danger); color: white; padding: 6px 12px; font-size: 0.8rem; }
.btn-add { background-color: var(--dark); color: white; margin-bottom: 10px; }

/* Footer Totals Section */
.footer-totals {
    background-color: #eef2f7;
}

@media (max-width: 768px) {
    body { padding: 0; background-color: white; }
    .container { padding: 10px; box-shadow: none; border-radius: 0; }
    .grid-layout { grid-template-columns: 1fr; gap: 10px; }
    .section { padding: 10px; }
    h2 { font-size: 1.5rem; margin-top: 10px; }

    /* Compact grid view for mobile */
    #gridTable th, #gridTable td {
        padding: 4px 2px; /* Reduce cell padding */
        border-left: none;  /* Remove vertical lines between columns */
        border-right: none;
    }
    #gridTable td input {
        padding: 8px 3px; /* Adjust input padding */
    }
}

/* Modal Styles */
.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.4); }
.modal-content { background-color: #fefefe; margin: 10% auto; padding: 20px; border: 1px solid #888; width: 300px; border-radius: 5px; box-shadow: 0 4px 8px rgba(0,0,0,0.2); }
.close { color: #aaa; float: right; font-size: 28px; font-weight: bold; cursor: pointer; }
.close:hover { color: black; }
.modal-textarea { width: 100%; height: 150px; font-size: 16px; padding: 10px; box-sizing: border-box; margin: 10px 0; border: 1px solid #ccc; border-radius: 4px; resize: vertical; }
.modal-stats { display: flex; justify-content: space-between; margin-bottom: 15px; font-weight: bold; background: #e9ecef; padding: 10px; border-radius: 4px; }

/* Accounting Standard Alignment */
.numeric-input {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.text-right {
    text-align: right;
}

/* Navigation */
.nav-link {
    margin-right: 10px;
    text-decoration: none;
    color: var(--dark);
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 5px;
}
.nav-link.active {
    background-color: var(--primary);
    color: white;
}
.nav-link:hover:not(.active) {
    background-color: #e9ecef;
}

/* Dashboard Filter */
.filter-bar {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    border: 1px solid #dee2e6;
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 10px;
}
.header-left {
    display: flex;
    align-items: center;
}
.page-title {
    border-bottom: none !important;
    margin: 0;
    padding: 0;
    margin-right: 20px;
}
.header-right {
    display: flex;
    align-items: center;
}
.user-info {
    margin-right: 15px;
    font-weight: bold;
}

/* Mobile Enhancements */
@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    .header-left {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    .header-left nav {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
    }
    .header-right {
        justify-content: space-between;
        background-color: #f8f9fa;
        padding: 10px;
        border-radius: 5px;
    }
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .filter-bar .form-group {
        width: 100%;
    }
    .filter-bar .btn {
        width: 100%;
        margin-top: 5px;
    }
    .summary-table th, .summary-table td {
        white-space: nowrap;
    }
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    gap: 8px;
    flex-wrap: wrap;
}
.pagination a {
    padding: 8px 16px;
    border: 1px solid var(--border);
    background-color: white;
    color: var(--primary);
    text-decoration: none;
    border-radius: 50px;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    min-width: 40px;
    text-align: center;
}
.pagination a:hover { background-color: #e9ecef; transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
.pagination a.active { background-color: var(--primary); color: white; border-color: var(--primary); box-shadow: 0 4px 8px rgba(0,123,255,0.3); }
.pagination a.disabled { color: #ccc; pointer-events: none; background-color: #f8f9fa; }
