/**
 * SDN Water Solutions - Pump Testing & Service Reporting System
 * Custom Stylesheet
 * Industrial theme: Blue/Grey/White color palette
 */

/* ========================================
   CSS Variables - Industrial Color Palette
   ======================================== */
:root {
    --sdn-primary: #1a5276;
    --sdn-primary-dark: #0e3a52;
    --sdn-primary-light: #2e86ab;
    --sdn-secondary: #5d6d7e;
    --sdn-accent: #2980b9;
    --sdn-success: #27ae60;
    --sdn-warning: #f39c12;
    --sdn-danger: #c0392b;
    --sdn-light: #ecf0f1;
    --sdn-dark: #2c3e50;
    --sdn-grey: #7f8c8d;
    --sdn-grey-light: #bdc3c7;
    --sdn-white: #ffffff;
    --sdn-bg: #f4f6f8;
}

/* ========================================
   Global Styles
   ======================================== */
body {
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--sdn-bg);
    color: var(--sdn-dark);
    min-height: 100vh;
}

/* ========================================
   Navigation
   ======================================== */
.navbar {
    background: linear-gradient(135deg, var(--sdn-primary) 0%, var(--sdn-primary-dark) 100%) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.navbar-brand {
    font-size: 1.1rem;
}

.navbar-brand img {
    filter: brightness(1.1);
}

.nav-link {
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.nav-link.active {
    background-color: rgba(255, 255, 255, 0.2);
}

/* ========================================
   Cards & Stat Cards
   ======================================== */
.card {
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.card-header {
    border-bottom: 1px solid var(--sdn-light);
    font-weight: 600;
}

.stat-card {
    border-radius: 10px;
    overflow: hidden;
}

.stat-card .card-body {
    padding: 1.5rem;
}

.stat-card .card-footer {
    padding: 0.75rem 1.5rem;
    background-color: rgba(0, 0, 0, 0.1) !important;
}

.stat-card h2 {
    font-size: 2.5rem;
    font-weight: 700;
}

/* ========================================
   Tables
   ======================================== */
.table {
    margin-bottom: 0;
}

.table th {
    font-weight: 600;
    color: var(--sdn-secondary);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    border-bottom-width: 2px;
    white-space: nowrap;
}

.table td {
    vertical-align: middle;
    padding: 0.875rem 0.75rem;
}

.table-hover tbody tr:hover {
    background-color: rgba(26, 82, 118, 0.04);
}

/* ========================================
   Buttons
   ======================================== */
.btn-primary {
    background-color: var(--sdn-primary);
    border-color: var(--sdn-primary);
}

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

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

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

.btn-action {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.btn-group-actions .btn {
    padding: 0.25rem 0.5rem;
}

/* ========================================
   Forms
   ======================================== */
.form-label {
    font-weight: 500;
    color: var(--sdn-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.375rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--sdn-accent);
    box-shadow: 0 0 0 0.2rem rgba(41, 128, 185, 0.15);
}

.form-control::placeholder {
    color: var(--sdn-grey-light);
}

/* ========================================
   Modals
   ======================================== */
.modal-header.bg-primary {
    background: linear-gradient(135deg, var(--sdn-primary) 0%, var(--sdn-primary-dark) 100%) !important;
}

.modal-content {
    border: none;
    border-radius: 10px;
    overflow: hidden;
}

/* ========================================
   Badges & Status Indicators
   ======================================== */
.badge-status-active {
    background-color: var(--sdn-success);
}

.badge-status-inactive {
    background-color: var(--sdn-grey);
}

.badge-type-engineer {
    background-color: var(--sdn-primary);
}

.badge-type-technician {
    background-color: var(--sdn-accent);
}

/* Report Type Badges */
.badge-report-fat-motorized {
    background-color: #3498db;
}

.badge-report-fat-diesel {
    background-color: #e67e22;
}

.badge-report-field-service {
    background-color: #9b59b6;
}

.badge-report-startup {
    background-color: #27ae60;
}

/* ========================================
   Tabs
   ======================================== */
.nav-tabs .nav-link {
    color: var(--sdn-secondary);
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.75rem 1.25rem;
}

.nav-tabs .nav-link:hover {
    border-color: transparent;
    color: var(--sdn-primary);
}

.nav-tabs .nav-link.active {
    color: var(--sdn-primary);
    background-color: transparent;
    border-color: transparent;
    border-bottom-color: var(--sdn-primary);
}

/* ========================================
   Report Wizard Steps
   ======================================== */
.wizard-steps {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
    padding: 0;
    list-style: none;
}

.wizard-step {
    display: flex;
    align-items: center;
    color: var(--sdn-grey);
}

.wizard-step:not(:last-child)::after {
    content: '';
    display: block;
    width: 60px;
    height: 2px;
    background-color: var(--sdn-grey-light);
    margin: 0 1rem;
}

.wizard-step.active {
    color: var(--sdn-primary);
    font-weight: 600;
}

.wizard-step.completed {
    color: var(--sdn-success);
}

.wizard-step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--sdn-grey-light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
}

.wizard-step.active .wizard-step-number {
    background-color: var(--sdn-primary);
    color: white;
}

.wizard-step.completed .wizard-step-number {
    background-color: var(--sdn-success);
    color: white;
}

/* ========================================
   ISO-Style Form Sections
   ======================================== */
.iso-section {
    margin-bottom: 1.5rem;
}

.iso-section-header {
    background-color: var(--sdn-primary);
    color: white;
    padding: 0.75rem 1rem;
    font-weight: 600;
    border-radius: 6px 6px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.iso-section-body {
    border: 1px solid var(--sdn-grey-light);
    border-top: none;
    border-radius: 0 0 6px 6px;
    padding: 1rem;
    background-color: white;
}

.iso-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--sdn-light);
}

.iso-item:last-child {
    border-bottom: none;
}

.iso-item-label {
    flex: 1;
    padding-right: 1rem;
}

.iso-item-input {
    flex: 0 0 150px;
}

.iso-item-unit {
    flex: 0 0 60px;
    color: var(--sdn-grey);
    font-size: 0.875rem;
    padding-left: 0.5rem;
}

/* Pass/Fail/NA Radio Group */
.pass-fail-group {
    display: flex;
    gap: 0.5rem;
}

.pass-fail-group .btn {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
}

.pass-fail-group .btn-outline-success.active {
    background-color: var(--sdn-success);
    color: white;
}

.pass-fail-group .btn-outline-danger.active {
    background-color: var(--sdn-danger);
    color: white;
}

.pass-fail-group .btn-outline-secondary.active {
    background-color: var(--sdn-grey);
    color: white;
}

/* ========================================
   Report View Styles
   ======================================== */
.report-header {
    background: linear-gradient(135deg, var(--sdn-primary) 0%, var(--sdn-primary-dark) 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.report-header .logo {
    max-height: 60px;
}

.report-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.report-detail-item {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 0.75rem;
    border-radius: 4px;
}

.report-detail-label {
    font-size: 0.75rem;
    opacity: 0.8;
    text-transform: uppercase;
}

.report-detail-value {
    font-weight: 600;
}

/* ========================================
   Template Manager
   ======================================== */
.template-item {
    cursor: pointer;
    transition: background-color 0.2s;
}

.template-item:hover {
    background-color: var(--sdn-light);
}

.template-item.active {
    background-color: var(--sdn-primary);
    color: white;
}

.section-item {
    background-color: var(--sdn-light);
    border-radius: 6px;
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.section-header {
    padding: 0.75rem 1rem;
    background-color: var(--sdn-secondary);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: grab;
}

.section-items {
    padding: 0.75rem;
}

.checklist-item {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    background-color: white;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    gap: 0.5rem;
}

.checklist-item:last-child {
    margin-bottom: 0;
}

.drag-handle {
    cursor: grab;
    color: var(--sdn-grey);
}

/* ========================================
   Loading Overlay
   ======================================== */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* ========================================
   Toast Notifications
   ======================================== */
.toast {
    min-width: 300px;
}

.toast.bg-success .toast-header {
    background-color: var(--sdn-success);
    color: white;
}

.toast.bg-danger .toast-header {
    background-color: var(--sdn-danger);
    color: white;
}

/* ========================================
   Utility Classes
   ======================================== */
.text-primary {
    color: var(--sdn-primary) !important;
}

.bg-primary {
    background-color: var(--sdn-primary) !important;
}

.border-primary {
    border-color: var(--sdn-primary) !important;
}

.cursor-pointer {
    cursor: pointer;
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ========================================
   Responsive Adjustments
   ======================================== */
@media (max-width: 768px) {
    .navbar-brand span {
        font-size: 0.9rem;
    }

    .stat-card h2 {
        font-size: 1.75rem;
    }

    .wizard-steps {
        flex-direction: column;
        align-items: flex-start;
    }

    .wizard-step:not(:last-child)::after {
        display: none;
    }

    .wizard-step {
        margin-bottom: 0.5rem;
    }

    .iso-item {
        flex-wrap: wrap;
    }

    .iso-item-label {
        flex: 1 1 100%;
        margin-bottom: 0.5rem;
    }

    .iso-item-input {
        flex: 1;
    }

    .report-details-grid {
        grid-template-columns: 1fr;
    }

    .table-responsive {
        font-size: 0.875rem;
    }

    .btn-group-actions {
        flex-direction: column;
    }
}

@media (max-width: 576px) {
    .navbar-brand img {
        height: 30px;
    }

    .card-body {
        padding: 1rem;
    }

    h2 {
        font-size: 1.5rem;
    }
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
    .navbar,
    .btn,
    .no-print {
        display: none !important;
    }

    body {
        background: white;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ========================================
   Parts Used Table (Field Service)
   ======================================== */
.parts-table {
    width: 100%;
}

.parts-table th {
    background-color: var(--sdn-light);
}

.parts-table input {
    border: 1px solid var(--sdn-grey-light);
    padding: 0.375rem 0.5rem;
    border-radius: 4px;
    width: 100%;
}

.parts-table input:focus {
    outline: none;
    border-color: var(--sdn-accent);
}

/* ========================================
   Signature Block
   ======================================== */
.signature-block {
    display: flex;
    justify-content: space-around;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid var(--sdn-grey-light);
}

.signature-item {
    text-align: center;
    min-width: 200px;
}

.signature-line {
    border-bottom: 1px solid var(--sdn-dark);
    height: 40px;
    margin-bottom: 0.5rem;
}

.signature-label {
    font-weight: 600;
    color: var(--sdn-secondary);
}

.signature-name {
    font-size: 1.1rem;
    margin-top: 0.25rem;
}

/* ========================================
   Empty State
   ======================================== */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--sdn-grey);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* ========================================
   Quick Add Buttons (Report Form)
   ======================================== */
.input-group-text.btn-add-new {
    cursor: pointer;
    background-color: var(--sdn-success);
    color: white;
    border-color: var(--sdn-success);
}

.input-group-text.btn-add-new:hover {
    background-color: #219a52;
}

/* ========================================
   Report Type Selection Cards
   ======================================== */
.report-type-card {
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.report-type-card:hover {
    border-color: var(--sdn-primary);
    transform: translateY(-2px);
}

.report-type-card.selected {
    border-color: var(--sdn-primary);
    background-color: rgba(26, 82, 118, 0.05);
}

.report-type-card .card-body {
    padding: 1.5rem;
}

.report-type-icon {
    font-size: 2.5rem;
    color: var(--sdn-primary);
    margin-bottom: 1rem;
}

/* ========================================
   Readings Table
   ======================================== */
.readings-table {
    width: 100%;
    border-collapse: collapse;
}

.readings-table th,
.readings-table td {
    border: 1px solid var(--sdn-grey-light);
    padding: 0.5rem;
    text-align: center;
}

.readings-table th {
    background-color: var(--sdn-light);
    font-weight: 600;
}

.readings-table input {
    width: 100%;
    border: none;
    text-align: center;
    padding: 0.25rem;
}

.readings-table input:focus {
    outline: none;
    background-color: rgba(41, 128, 185, 0.1);
}

/* ========================================
   Equipment Photo Sections
   ======================================== */
.equipment-photo-section {
    padding: 1rem;
    background-color: var(--sdn-light);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.equipment-photo-section h6 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.equipment-photo-section h6 .badge {
    font-size: 0.7rem;
    font-weight: 500;
}

.equipment-photo-upload {
    border: 2px dashed var(--sdn-grey-light);
    border-radius: 8px;
    padding: 2rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background-color: white;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.equipment-photo-upload:hover {
    border-color: var(--sdn-primary);
    background-color: rgba(26, 82, 118, 0.02);
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--sdn-grey);
}

.upload-placeholder i {
    font-size: 2.5rem;
    color: var(--sdn-grey-light);
}

.upload-placeholder span {
    font-weight: 600;
    font-size: 0.9rem;
}

.upload-placeholder small {
    font-size: 0.75rem;
}

.equipment-photo-card {
    border-radius: 8px;
    overflow: hidden;
    background-color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.photo-preview-wrapper {
    position: relative;
    height: 150px;
    overflow: hidden;
}

.photo-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.5rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    opacity: 0;
    transition: opacity 0.2s;
}

.photo-preview-wrapper:hover .photo-overlay {
    opacity: 1;
}

.photo-caption-wrapper {
    padding: 0.5rem;
}

.photo-caption-wrapper input {
    font-size: 0.8rem;
}

/* Report View Photo Grid */
.report-photo-section {
    margin-top: 1.5rem;
}

.report-photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.report-photo-item {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.report-photo-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.report-photo-caption {
    padding: 0.5rem;
    background-color: white;
    font-size: 0.8rem;
    text-align: center;
}

.report-photo-label {
    font-weight: 600;
    color: var(--sdn-primary);
    font-size: 0.7rem;
    text-transform: uppercase;
}
