/* Root variables for colors matching the Swift app */
:root {
    --custom-text-color: rgb(0, 20, 137);
    --background-color: rgb(215, 218, 230);
    --submit-button-color: rgb(65, 117, 113);
    --white: #ffffff;
    --black: #000000;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--background-color);
    color: var(--custom-text-color);
    min-height: 100vh;
}

/* Login View Styles */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

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

.login-form h2 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--custom-text-color);
    font-size: 28px;
    font-weight: bold;
}

/* Main View Styles */
.main-container {
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
    transition: max-width 0.3s ease;
}

/* Wider container for reports view */
.main-container.reports-active {
    max-width: 1400px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px 0;
    width: 100%;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

.nav-buttons {
    display: flex !important;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    visibility: visible !important;
}

.nav-btn {
    padding: 8px 16px;
    border: 1px solid var(--background-color);
    background: var(--white);
    color: var(--custom-text-color);
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    font-weight: 500;
    white-space: nowrap;
    min-width: 80px;
}

.nav-btn:hover {
    background: #f5f5f5;
}

/* Specific styling for Branch Report button */
#reportsTabBtn {
    background: #B15533;
    color: var(--white);
    border-color: #B15533;
}

#reportsTabBtn:hover {
    background: #9A4A2C;
    border-color: #9A4A2C;
}

#reportsTabBtn.active {
    background: #B15533;
    color: var(--white);
    border-color: #B15533;
}

/* Specific styling for New Issue button */
#issueTabBtn {
    background: #001489;
    color: var(--white);
    border-color: #001489;
}

#issueTabBtn:hover {
    background: #000f73;
    border-color: #000f73;
}

#issueTabBtn.active {
    background: #001489;
    color: var(--white);
    border-color: #001489;
}

.logo-image {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 8px;
}

.header h1 {
    color: var(--custom-text-color);
    font-size: 40px;
    font-weight: bold;
}

.logout-btn {
    background: var(--submit-button-color);
    color: var(--white);
    border: 1px solid var(--submit-button-color);
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
    min-width: 80px;
}

.logout-btn:hover {
    opacity: 0.8;
}

/* Form Styles */
.issue-form {
    background: var(--white);
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Reports View Styles */
.reports-container {
    background: var(--white);
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.reports-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--custom-text-color);
}

.reports-header h2 {
    color: var(--custom-text-color);
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 20px;
}

.report-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.report-controls select,
.report-controls input {
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    color: var(--custom-text-color);
    background: var(--white);
    transition: border-color 0.3s ease;
}

.report-controls select:focus,
.report-controls input:focus {
    outline: none;
    border-color: var(--custom-text-color);
}

.report-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.report-btn {
    background: var(--submit-button-color);
    color: var(--white);
}

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

.report-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

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

.loading {
    text-align: center;
    padding: 40px;
}

.loading p {
    color: var(--custom-text-color);
    font-size: 16px;
    font-style: italic;
}

.report-content {
    margin-top: 20px;
}

.no-data {
    text-align: center;
    padding: 40px;
    color: var(--background-color);
    font-style: italic;
    font-size: 16px;
}

.report-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid var(--submit-button-color);
    text-align: center;
}

.summary-card h4 {
    color: var(--custom-text-color);
    font-size: 14px;
    margin-bottom: 10px;
    font-weight: 500;
}

.summary-card .value {
    color: var(--submit-button-color);
    font-size: 24px;
    font-weight: bold;
}

.issues-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.issues-table th,
.issues-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.issues-table th {
    background: var(--custom-text-color);
    color: var(--white);
    font-weight: 600;
    font-size: 14px;
}

.issues-table td {
    color: var(--custom-text-color);
    font-size: 14px;
}

.issues-table tr:hover {
    background: #f8f9fa;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
}

.status-open {
    background: #ffebee;
    color: #c62828;
}

.status-in-progress {
    background: #fff3e0;
    color: #f57c00;
}

.status-resolved {
    background: #e8f5e8;
    color: #2e7d32;
}

.date-range-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.issue-description {
    max-width: 300px;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.4;
}

/* Wider issue description in reports view */
.main-container.reports-active .issue-description {
    max-width: 500px;
}

/* Better table spacing in reports view */
.main-container.reports-active .issues-table th,
.main-container.reports-active .issues-table td {
    padding: 15px 12px;
}

.error-message {
    background: #ffebee;
    color: #c62828;
    padding: 15px;
    border-radius: 5px;
    border-left: 4px solid #c62828;
    margin: 20px 0;
}

.form-section {
    margin-bottom: 30px;
}

.form-section h3 {
    color: var(--custom-text-color);
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    padding-bottom: 5px;
    border-bottom: 2px solid var(--custom-text-color);
}

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

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

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    color: var(--custom-text-color);
    background: var(--white);
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--custom-text-color);
}

.form-group input[readonly] {
    background-color: #f5f5f5;
    color: #666;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.submit-section {
    text-align: center;
    margin-top: 30px;
}

.submit-btn,
.login-btn {
    background: var(--submit-button-color);
    color: var(--white);
    border: none;
    padding: 15px 40px;
    border-radius: 5px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 200px;
}

.submit-btn:hover,
.login-btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.submit-btn:active,
.login-btn:active {
    transform: translateY(0);
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: var(--white);
    padding: 15px 25px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(-10px);
}

/* Filter Controls Styles */
.filter-controls {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.filter-row {
    display: flex;
    gap: 15px;
    align-items: end;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    min-width: 150px;
    flex: 1;
}

.filter-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--custom-text-color);
    margin-bottom: 5px;
}

.filter-select,
.filter-input {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    color: var(--custom-text-color);
    background: white;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Specific styling for date inputs - keep it simple to preserve native functionality */
input[type="date"].filter-input {
    font-family: inherit;
    cursor: pointer;
    position: relative;
    background: white;
    min-width: 150px;
}

/* Don't override the native date picker styling too much */
input[type="date"].filter-input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.8;
}

input[type="date"].filter-input::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* For Firefox - keep the native picker */
input[type="date"].filter-input::-moz-calendar-picker-indicator {
    cursor: pointer;
}

.filter-select:focus,
.filter-input:focus {
    outline: none;
    border-color: var(--submit-button-color);
    box-shadow: 0 0 0 2px rgba(65, 117, 113, 0.2);
}

/* Ensure search input stays focusable and interactive */
#searchFilter {
    position: relative;
    z-index: 10;
    pointer-events: auto;
}

#searchFilter:focus {
    z-index: 11;
    outline: none;
    border-color: var(--submit-button-color);
    box-shadow: 0 0 0 3px rgba(65, 117, 113, 0.3);
}

.filter-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--submit-button-color);
    color: white;
    margin-top: 8px;
}

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

.filter-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* Export Controls Styles */
.export-controls {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.export-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #63666A;
    color: white;
}

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

.export-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

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

/* Enhanced DataTables styling */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    margin-bottom: 10px;
}

.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 4px 8px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border: 1px solid #dee2e6;
    border-radius: 4px;
    margin: 0 2px;
    padding: 6px 12px;
    background: white;
    color: var(--custom-text-color);
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--background-color);
    border-color: var(--submit-button-color);
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--submit-button-color);
    color: white;
    border-color: var(--submit-button-color);
}

/* Clean table styling without extra header filters */
.clean-table {
    border-collapse: collapse;
    width: 100%;
    margin-top: 20px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.clean-table th {
    background: var(--custom-text-color);
    color: white;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
}

.clean-table td {
    padding: 12px;
    border-bottom: 1px solid #dee2e6;
    font-size: 14px;
    color: var(--custom-text-color);
}

.clean-table tr:hover {
    background: #f8f9fa;
}

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

/* Results count styling */
.results-count {
    color: #666;
    font-size: 14px;
    margin: 10px 0;
    font-style: italic;
}

/* Sort indicators */
.sort-indicator {
    font-size: 12px;
    margin-left: 5px;
    opacity: 0.7;
}

.clean-table th[data-sort="asc"] .sort-indicator {
    opacity: 1;
    color: var(--submit-button-color);
}

.clean-table th[data-sort="desc"] .sort-indicator {
    opacity: 1;
    color: var(--submit-button-color);
}

/* Enhanced hover effects for sortable headers */
.clean-table th[style*="cursor: pointer"]:hover {
    background: #003399;
    transition: background-color 0.2s ease;
}

/* Loading state improvements */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--custom-text-color);
}

.loading p {
    font-size: 16px;
    margin: 0;
}

/* No data state improvements */
.no-data {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-style: italic;
    font-size: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
}
/* State column styles */
.status-cell {
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 6px;
    text-align: center;
    font-size: 13px;
    white-space: nowrap;
}

.status-open {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

.status-pending {
    background: #fff3e0;
    color: #f57c00;
    border: 1px solid #ffcc02;
}

.status-resolved {
    background: #e8f5e8;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.status-closed {
    background: #f3e5f5;
    color: #7b1fa2;
    border: 1px solid #ce93d8;
}

.status-cancelled {
    background: #fafafa;
    color: #616161;
    border: 1px solid #e0e0e0;
}

.status-default {
    background: #e3f2fd;
    color: #1976d2;
    border: 1px solid #90caf9;
}

/* Dropdown styles for category and state selectors */
.category-dropdown,
.state-dropdown {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    background: var(--white);
    color: var(--custom-text-color);
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 100px;
    -webkit-appearance: menulist;
    -moz-appearance: menulist;
    appearance: menulist;
    /* Ensure dropdown stays interactive in Chrome */
    position: relative;
    z-index: 1;
}

.category-dropdown:hover,
.state-dropdown:hover {
    border-color: var(--custom-text-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 2;
}

.category-dropdown:focus,
.state-dropdown:focus {
    outline: none;
    border-color: var(--submit-button-color);
    box-shadow: 0 0 0 2px rgba(65, 117, 113, 0.2);
    z-index: 3;
}

.category-dropdown:disabled,
.state-dropdown:disabled {
    cursor: not-allowed;
    opacity: 0.6;
    background: #f5f5f5;
    pointer-events: none;
}

/* State dropdown inherits status colors when selected */
.state-dropdown.status-open {
    background: #ffebee;
    color: #c62828;
    border-color: #ffcdd2;
}

.state-dropdown.status-pending {
    background: #fff3e0;
    color: #f57c00;
    border-color: #ffcc02;
}

.state-dropdown.status-resolved {
    background: #e8f5e8;
    color: #2e7d32;
    border-color: #a5d6a7;
}

.state-dropdown.status-closed {
    background: #f3e5f5;
    color: #7b1fa2;
    border-color: #ce93d8;
}

.state-dropdown.status-cancelled {
    background: #fafafa;
    color: #616161;
    border-color: #e0e0e0;
}

.state-dropdown.status-default {
    background: #e3f2fd;
    color: #1976d2;
    border-color: #90caf9;
}

/* Table cell adjustments for dropdowns */
.category-cell,
.state-cell {
    padding: 8px 6px;
    vertical-align: middle;
    position: relative;
    /* Ensure dropdown interaction isn't blocked */
    overflow: visible;
}

.category-cell {
    min-width: 130px;
}

.state-cell {
    min-width: 130px;
}

/* Ensure table doesn't interfere with dropdown interaction */
.issues-table {
    position: relative;
}

.issues-table tr {
    position: relative;
}

.issues-table td {
    position: relative;
}

/* Update table column widths for new columns */
.main-container.reports-active .issues-table th:nth-child(1),
.main-container.reports-active .issues-table td:nth-child(1) {
    width: 100px; /* Order # */
}

.main-container.reports-active .issues-table th:nth-child(2),
.main-container.reports-active .issues-table td:nth-child(2) {
    width: 150px; /* Customer */
}

.main-container.reports-active .issues-table th:nth-child(3),
.main-container.reports-active .issues-table td:nth-child(3) {
    width: auto; /* Issue Description */
    min-width: 300px;
}

.main-container.reports-active .issues-table th:nth-child(4),
.main-container.reports-active .issues-table td:nth-child(4) {
    width: 140px; /* Category */
}

.main-container.reports-active .issues-table th:nth-child(5),
.main-container.reports-active .issues-table td:nth-child(5) {
    width: 140px; /* State */
}

.main-container.reports-active .issues-table th:nth-child(6),
.main-container.reports-active .issues-table td:nth-child(6) {
    width: 120px; /* Submitter */
}

.main-container.reports-active .issues-table th:nth-child(7),
.main-container.reports-active .issues-table td:nth-child(7) {
    width: 140px; /* Date */
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-container {
        padding: 10px;
    }
    
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .nav-buttons {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
        width: 100%;
    }
    
    .nav-btn {
        font-size: 13px;
        padding: 6px 12px;
        min-width: 70px;
    }
    
    .logout-btn {
        font-size: 13px;
        padding: 6px 12px;
    }
    
    .header h1 {
        font-size: 32px;
        margin: 0;
    }
    
    .logo-section {
        gap: 10px;
    }
    
    .logo-image {
        width: 60px;
        height: 60px;
    }
    
    .issue-form, .reports-container {
        padding: 20px;
    }
    
    .login-form {
        padding: 30px 20px;
    }
    
    .report-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .report-controls select,
    .report-controls input,
    .report-btn {
        width: 100%;
    }
    
    .report-summary {
        grid-template-columns: 1fr;
    }
    
    .issues-table, .clean-table {
        font-size: 12px;
    }
    
    .issues-table th,
    .issues-table td,
    .clean-table th,
    .clean-table td {
        padding: 8px 4px;
    }
    
    /* Mobile filter controls */
    .filter-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .filter-group {
        min-width: auto;
        width: 100%;
    }
    
    .export-controls {
        justify-content: center;
    }
    
    .export-btn {
        flex: 1;
        min-width: 80px;
    }
    
    /* Mobile status cell adjustments */
    .status-cell {
        font-size: 11px;
        padding: 4px 8px;
    }
    
    /* Mobile dropdown adjustments */
    .category-dropdown,
    .state-dropdown {
        font-size: 11px;
        padding: 2px 4px;
        min-width: 80px;
    }
    
    .category-cell,
    .state-cell {
        padding: 4px 2px;
        min-width: 90px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 28px;
    }
    
    .logo-image {
        width: 60px;
        height: 60px;
    }
    
    .form-group input,
    .form-group textarea {
        font-size: 14px;
        padding: 10px;
    }
}

