/* Main Styles */
:root {
    --primary-color: #0d47a1;
    --secondary-color: #1976d2;
    --accent-color: #2196f3;
    --light-color: #f5f5f5;
    --dark-color: #212121;
    --success-color: #4caf50;
    --warning-color: #ff9800;
    --danger-color: #f44336;
    --info-color: #2196f3;
    --text-color: #333333;
    --text-light: #ffffff;
    --border-radius: 0.25rem;
    --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --transition: all 0.3s ease;
    --font-family: Arial, sans-serif;
}

body {
    font-family: var(--font-family);
    color: var(--text-color);
    background-color: #f8f9fa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.navbar-brand {
    font-family: Arial, sans-serif;
    font-weight: bold;
    letter-spacing: 0.5px;
}

.footer {
    margin-top: auto;
}

/* Card styles */
.card {
    box-shadow: var(--box-shadow);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card-header {
    font-weight: 500;
}

/* Button styles */
.btn {
    border-radius: var(--border-radius);
    transition: var(--transition);
}

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

.btn-primary:hover {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
}

/* Table styles */
.table th {
    background-color: #f8f9fa;
    font-weight: 600;
    border-top: none;
    padding: 0.75rem 1rem;
}

.table td {
    padding: 0.25rem 0.5rem;
    vertical-align: middle;
    white-space: nowrap;
    height: 38px;
}

/* Quotations table specific styling */
.quotations-table {
    table-layout: fixed !important;
}

.quotations-table .col-name {
    width: 35% !important;
    max-width: 35% !important;
    min-width: 35% !important;
}

/* Sales customers table specific styling - removed to allow HTML inline styles */

/* Ensure table uses fixed layout for consistent column widths */
.table-striped {
    table-layout: fixed;
}


.table-hover tbody tr:hover {
    background-color: rgba(13, 71, 161, 0.05);
}

.project-color-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.icon-box {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

/* Form styling improvements */
.form-floating > .form-control {
    padding: 1rem 0.75rem;
}

.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label {
    opacity: 0.65;
    transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
}

.form-floating > label {
    padding: 1rem 0.75rem;
}

/* Badge styling */
.badge {
    font-weight: 500;
    padding: 0.3em 0.6em;
    font-size: 0.8em;
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .table-container {
        max-height: none !important;
        overflow: visible !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #dee2e6 !important;
    }
    
    .table th, .table td {
        background-color: white !important;
        color: black !important;
    }
    
    .badge {
        border: 1px solid #dee2e6 !important;
        color: black !important;
        background-color: white !important;
    }
    
    .badge.bg-success, .badge.bg-danger {
        font-weight: bold !important;
    }
}

/* Dark mode text visibility fixes */
[data-bs-theme="dark"] .form-check-label,
[data-bs-theme="dark"] .card-header h6,
[data-bs-theme="dark"] .input-group-text,
[data-bs-theme="dark"] .form-control-label,
[data-bs-theme="dark"] label,
[data-bs-theme="dark"] .form-label {
    color: #f8f9fa !important;
}

[data-bs-theme="dark"] .card-body {
    color: #e9ecef;
}

[data-bs-theme="dark"] .form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

[data-bs-theme="dark"] .input-group-text {
    background-color: #343a40;
    border-color: #495057;
    color: #f8f9fa !important;
}

[data-bs-theme="dark"] .card {
    background-color: #2b3035;
    border-color: #495057;
}

[data-bs-theme="dark"] .card-header {
    background-color: #343a40;
    border-color: #495057;
}

/* Specific fixes for project controlling page */
[data-bs-theme="dark"] #hourlyFixedCost + label,
[data-bs-theme="dark"] #revenueFixedCost + label {
    color: #ffffff !important;
}

[data-bs-theme="dark"] .card-header h6.mb-0 {
    color: #ffffff !important;
    font-weight: 500;
}

/* Form styles */
.form-control:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 71, 161, 0.25);
}

/* Navbar styles */
.navbar-dark.bg-primary {
    background-color: var(--primary-color) !important;
}

.navbar-dark .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.85);
}

.navbar-dark .navbar-nav .nav-link:hover {
    color: rgba(255, 255, 255, 1);
}

/* Badge styles */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
}

/* Progress bar styles */
.progress {
    height: 0.8rem;
    border-radius: var(--border-radius);
}

/* Alert styles */
.alert {
    border-radius: var(--border-radius);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .card-body {
        padding: 1rem;
    }
}

/* Fixed table header and columns */
.table-fixed-header-columns {
    position: relative;
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}


/* Sticky header */
.table-fixed-header-columns thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #f8f9fa;
    box-shadow: 0 1px 1px rgba(0,0,0,0.1);
    padding: 0.25rem 0.5rem; /* Further reduced padding for more compact header */
    height: 38px; /* Fixed height for header row */
}

/* First column (ID) */
.table-fixed-header-columns th:first-child,
.table-fixed-header-columns td:first-child {
    position: sticky;
    left: 0;
    z-index: 20;
    min-width: 50px;
    width: 50px;
}

/* Second column (Project name) */
.table-fixed-header-columns th:nth-child(2),
.table-fixed-header-columns td:nth-child(2) {
    position: sticky;
    left: 50px; /* Width of the first column */
    z-index: 21; /* Higher than regular cells but lower than header */
    min-width: 210px;
    width: 210px;
}

/* Corner cells (intersection of sticky header and sticky columns) */
.table-fixed-header-columns thead th:first-child {
    z-index: 31; /* Highest z-index for first corner */
    left: 0;
}

.table-fixed-header-columns thead th:nth-child(2) {
    z-index: 30; /* High z-index for second corner */
    left: 50px;
    max-width: 210px;
}

/* Ensure regular cells have lower z-index than sticky columns */
.table-fixed-header-columns td {
    z-index: 1;
}

/* Add proper shadows for visual separation */
.table-fixed-header-columns th:first-child,
.table-fixed-header-columns td:first-child {
    box-shadow: inset -1px 0 0 #dee2e6;
}

.table-fixed-header-columns th:nth-child(2),
.table-fixed-header-columns td:nth-child(2) {
    box-shadow: 1px 0 0 #dee2e6;
}

.table-fixed-header-columns thead th {
    box-shadow: inset 0 -1px 0 #dee2e6;
}

/* Hover states for fixed columns */
.table-fixed-header-columns tbody tr:hover td {
    background-color: rgba(13, 71, 161, 0.05);
}

.table-fixed-header-columns tbody tr:hover td:first-child {
    background-color: rgba(13, 71, 161, 0.08);
}

.table-fixed-header-columns tbody tr:hover td:nth-child(2) {
    background-color: rgba(13, 71, 161, 0.08);
}

/* Ensure proper background colors for sticky elements */
.table-fixed-header-columns th.bg-primary {
    background-color: var(--primary-color) !important;
}

.table-fixed-header-columns td:first-child,
.table-fixed-header-columns td:nth-child(2) {
    background-color: #f8f9fa;
}

.table-striped-improved tbody tr:nth-of-type(odd) td:first-child,
.table-striped-improved tbody tr:nth-of-type(odd) td:nth-child(2) {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Ensure fixed columns have solid backgrounds */
.table-fixed-header-columns.table-striped-improved tbody tr:nth-of-type(even) td:first-child,
.table-fixed-header-columns.table-striped-improved tbody tr:nth-of-type(even) td:nth-child(2) {
    background-color: #f8f9fa;
}

.table-fixed-header-columns.table-striped-improved tbody tr:nth-of-type(odd) td:first-child,
.table-fixed-header-columns.table-striped-improved tbody tr:nth-of-type(odd) td:nth-child(2) {
    background-color: #f0f0f0;
}

/* Maintain background colors on hover */
.table-fixed-header-columns.table-striped-improved tbody tr:hover td:first-child,
.table-fixed-header-columns.table-striped-improved tbody tr:hover td:nth-child(2) {
    background-color: rgba(13, 71, 161, 0.08);
}

.table-container {
    max-height: 70vh;
    overflow: auto;
    margin-bottom: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    position: relative; /* Needed for sticky positioning context */
}

/* Ensure proper background for sticky elements */
.bg-light {
    background-color: #f8f9fa !important;
}

/* Fullscreen mode for resource editor */
.fullscreen-mode {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background-color: #fff;
    overflow: auto;
    padding: 20px;
}

.fullscreen-mode .card {
    height: 100%;
    margin: 0;
    border: none;
    box-shadow: none;
}

.fullscreen-mode .table-container {
    max-height: calc(100vh - 150px);
}

.fullscreen-mode .card-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: #fff;
}

/* Ensure single-line content in table cells */
.table-fixed-header-columns td > div,
.table-fixed-header-columns td > span,
.table-fixed-header-columns td > a {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    display: inline-block;
}

/* Improved table styling */
.table-striped-improved tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.02);
}

.table-striped-improved tbody tr:hover {
    background-color: rgba(13, 71, 161, 0.05);
}

.table-striped-improved th {
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
}

.table-striped-improved td, 
.table-striped-improved th {
    padding: 0.25rem 0.5rem;
    vertical-align: middle;
    white-space: nowrap;
    height: 38px;
}

/* Status indicators */
.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
}

.status-active {
    background-color: var(--success-color);
}

.status-pending {
    background-color: var(--warning-color);
}

.status-completed {
    background-color: var(--info-color);
}

.status-cancelled {
    background-color: var(--danger-color);
}

/* Priority indicators */
.priority-high {
    color: var(--danger-color);
}

.priority-normal {
    color: var(--primary-color);
}

.priority-low {
    color: var(--info-color);
}
