/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html,
body {
    height: 100%;
    width: 100%;
    overflow-x: hidden;
}

body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
    padding: 0;
    /* Removed 20px padding to use full screen */
}

#app {
    height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* Navigation Styles */
.nav-container {
    display: flex;
    gap: 10px;
    padding: 10px;
    /* Adjusted for full-screen layout */
    background-color: #007bff;
}

.nav-container button,
.nav-container a {
    flex: 1;
    padding: 12px;
    font-size: 16px;
    font-weight: 500;
    background-color: #e9ecef;
    border: none;
    border-radius: 35px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.1s;
    text-align: center;
    color: #333;
    text-decoration: none;
}

.nav-container a.router-link-exact-active {
    background-color: #0056b3;
    color: #fff;
}

.nav-container button i,
.nav-container a i {
    margin-right: 8px;
}

.nav-container button.active {
    background-color: #0056b3;
    color: #fff;
}

.nav-container button:hover:not(.active),
.nav-container a:hover:not(.router-link-exact-active) {
    background-color: #d1d4d8;
}

.nav-container button:active,
.nav-container a:active {
    transform: scale(0.98);
}

/* Form View Styles */
.form-view {
    max-width: 800px;
    margin: 0 auto;
    background-color: #fff;
    padding: 20px;
    /* border-radius: 12px; */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    flex: 1;
    /* Ensure it takes remaining space */
    overflow-y: auto;
    /* Allow scrolling if content overflows */
    min-height: 1280px;
}

.form-view h1 {
    font-size: 24px;
    margin-bottom: 20px;
    color: #007bff;
    text-align: center;
}

.inspection-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 16px;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group select {
    padding: 12px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #f9f9f9;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.3);
}

.input-with-button {
    display: flex;
    gap: 10px;
    align-items: center;
}

.input-with-button input {
    flex: 1;
}

.input-with-button button {
    padding: 12px;
    background-color: #007bff;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.1s;
}

.input-with-button button:hover {
    background-color: #0056b3;
}

.input-with-button button:active {
    transform: scale(0.98);
}

/* Annotation Tools */
.annotation-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin: 20px 0;
}

.annotation-tools button {
    padding: 12px 16px;
    font-size: 16px;
    background-color: #007bff;
    color: #1b1ecb;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.3s, transform 0.1s;
}

.annotation-tools button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.annotation-tools button:hover:not(:disabled) {
    background-color: #0056b3;
}

.annotation-tools button:active:not(:disabled) {
    transform: scale(0.98);
}

/* Canvas */
.canvas-container {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.canvas-container canvas {
    border: 2px solid #ddd;
    border-radius: 8px;
    max-width: 100%;
    height: auto;
}

/* Submit Button */
.submit-btn {
    padding: 14px;
    font-size: 16px;
    font-weight: 500;
    background-color: #28a745;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background-color 0.3s, transform 0.1s;
}

.submit-btn:hover {
    background-color: #218838;
}

.submit-btn:active {
    transform: scale(0.98);
}

/* Status */
.status {
    text-align: center;
    font-size: 14px;
    color: #777;
    margin-top: 20px;
}

/* Reports View */
.reports-view {
    max-width: 800px;
    margin: 0 auto;
    background-color: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    flex: 1;
    /* Ensure it takes remaining space */
    overflow-y: auto;
    /* Allow scrolling if content overflows */
}

.reports-view h1 {
    font-size: 24px;
    margin-bottom: 20px;
    color: #007bff;
    text-align: center;
}

.back-btn {
    padding: 12px 16px;
    font-size: 16px;
    background-color: #6c757d;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    transition: background-color 0.3s, transform 0.1s;
}

.back-btn:hover {
    background-color: #5a6268;
}

.back-btn:active {
    transform: scale(0.98);
}

.no-records {
    text-align: center;
    font-size: 16px;
    color: #777;
    padding: 20px;
}

.reports-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.report-item {
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.report-item h3 {
    font-size: 18px;
    margin-bottom: 10px;
    color: #333;
}

.report-item p {
    font-size: 14px;
    color: #555;
    margin-bottom: 10px;
}

.annotated-image img,
.image-gallery img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-top: 10px;
}

.image-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* Tablet Optimization (min-width: 768px) */
@media (min-width: 768px) {

    .form-view,
    .reports-view {
        padding: 30px;
    }

    .form-view h1,
    .reports-view h1 {
        font-size: 28px;
    }

    .form-group label {
        font-size: 18px;
    }

    .form-group input,
    .form-group select {
        font-size: 18px;
        padding: 14px;
    }

    .annotation-tools button {
        padding: 14px 20px;
        font-size: 18px;
    }

    .submit-btn {
        padding: 16px;
        font-size: 18px;
    }

    .report-item h3 {
        font-size: 20px;
    }

    .report-item p {
        font-size: 16px;
    }

    .scanner-modal {
        padding: 30px;
    }

    .scanner-modal h2 {
        font-size: 24px;
    }

    .stop-btn {
        padding: 14px 20px;
        font-size: 18px;
    }
}

/* Barcode Scanner Overlay */
.scanner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.scanner-modal {
    background-color: #fff;
    padding: 20px;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.scanner-modal h2 {
    font-size: 20px;
    margin-bottom: 15px;
    color: #007bff;
}

#scanner-container {
    position: relative;
    width: 100%;
    padding-top: 75%;
    /* 4:3 aspect ratio for video */
    background-color: #000;
    border-radius: 8px;
    overflow: hidden;
}

#scanner-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.stop-btn {
    margin-top: 15px;
    padding: 12px 16px;
    font-size: 16px;
    background-color: #dc3545;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    transition: background-color 0.3s, transform 0.1s;
}

.stop-btn:hover {
    background-color: #c82333;
}

.stop-btn:active {
    transform: scale(0.98);
}

/* Full-Screen Adjustments for Standalone Mode */
@media (display-mode: standalone) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }

    .nav-container {
        padding-top: calc(10px + env(safe-area-inset-top));
    }
}

/* Two-column layout */
.two-column-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.two-column-layout .column {
    flex: 1;
    min-width: 300px;
}

/* Status indicator circle */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-circle {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.status-circle.online {
    background-color: green;
}

.status-circle.offline {
    background-color: red;
}

/* Damage table */
.damage-table {
    margin-top: 10px;
}

.table-header,
.table-row {
    display: grid;
    grid-template-columns: 50px 1fr 1fr 1fr 50px;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #ddd;
}

.table-header {
    font-weight: bold;
    background-color: #f0f0f0;
}

.table-row input {
    width: 100%;
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.remove-btn,
.add-btn {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 5px;
    cursor: pointer;
    border-radius: 4px;
}

.add-btn {
    background-color: #28a745;
    margin-top: 10px;
}

/* Index table */
.index-table {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.index-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
}

.index-row.damage-codes {
    border-top: 1px solid #ddd;
    margin-top: 10px;
    padding-top: 10px;
}

.index-row span {
    flex: 1;
}

/* Switch styles */
.switch {
    display: flex;
    align-items: center;
    gap: 10px;
}

.switch input[type="checkbox"] {
    margin: 0 10px;
}

/* Conditional input for vehicle type */
.input-with-conditional {
    display: flex;
    gap: 10px;
    align-items: center;
}

.conditional-input {
    flex: 1;
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* Section styles */
.section {
    margin-top: 20px;
}

.section h2 {
    font-size: 1.5em;
    margin-bottom: 10px;
}

.section h3 {
    font-size: 1.2em;
    margin-bottom: 10px;
    background: #edf4ff;
    padding:5px;
    border-radius:10px;
}


/* Toggle Switch (inspired by W3Schools) */
.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.4s;
}

input:checked+.slider {
    background-color: #2196F3;
}

input:focus+.slider {
    box-shadow: 0 0 1px #2196F3;
}

input:checked+.slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Form group adjustments for toggle switches */
.form-group {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.form-group label:not(.switch) {
    flex: 1;
}

/* Index table adjustments */
.index-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    /* Changed to 2 columns */
    gap: 10px;
    padding: 5px 0;
}

.index-row span {
    display: flex;
    align-items: center;
}

/* Toggle button for Damage Code Index */
.toggle-btn {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    border-radius: 4px;
    margin-bottom: 10px;
}

.toggle-btn:hover {
    background-color: #0056b3;
}

/* Annotation tools buttons */
.annotation-tools {
    display: flex;
    gap: 5px;
    flex-wrap: nowrap;
}

.annotation-tools button {
    padding: 5px 10px;
    /* Reduced padding to make buttons smaller */
    font-size: 14px;
    /* Reduced font size */
}

.annotation-tools button i {
    font-size: 14px;
    /* Reduced icon size */
}

#annotationCanvas {
    border: 1px solid black !important;
    display: block !important;
    visibility: visible !important;
    position: relative !important;
    z-index: 1 !important;
    /* width: 500px !important;
    height: 500px !important; */
    opacity: 1 !important;
}

#annotationCanvasContainer {
    display: block !important;
    visibility: visible !important;
    overflow: visible !important;
    position: relative !important;
    z-index: 1 !important;
    /* width: 500px !important;
    height: 500px !important; */
}

.canvas-container {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.canvas-fallback {
    color: red;
    font-size: 16px;
    margin-top: 10px;
}


.form-view {
    max-width: 900px;
    margin: 0 auto;
    overflow-x: hidden;
    /* Prevent horizontal scrollbar */
}

.canvas-container {
    width: 100%;
    height: 100%;
    position: relative;
}

#annotationCanvas {
    display: block;
    /* Ensure canvas is a block element */
}

/* #annotationCanvasContainer textarea{
    left: 650px !important;
} */

#annotationCanvasContainer {
    position: relative;
    width: 800px;
    /* Matches canvas width */
    height: 600px;
    /* Matches canvas height */
    overflow: hidden;
    /* Clips any overflow, including the textarea */
    margin: 0 auto;
    /* Center the container */
}

#annotationCanvasContainer textarea {
    /* Remove the hardcoded left position */
    /* Ensure the textarea doesn't affect the layout */
    max-width: 200px;
    /* Arbitrary width to ensure it fits within the canvas */
    overflow: hidden;
    /* Prevent the textarea itself from causing overflow */
    box-sizing: border-box;
}



.form-view {
    max-width: 900px;
    margin: 0 auto;
    position: relative;
    overflow-x: hidden;
    box-sizing: border-box;
    width: 100%;
}

#annotationCanvasContainer {
    position: relative;
    width: 800px;
    height: 600px;
    overflow: hidden;
    margin: 0 auto;
    box-sizing: border-box;
}

#annotationCanvasContainer canvas {
    width: 800px !important;
    height: 600px !important;
}

#annotationCanvasContainer textarea {
    max-width: 200px;
    overflow: hidden;
    box-sizing: border-box;
    position: absolute;
    left: 0 !important;
    /* Ensure positioning relative to container */
    top: 0 !important;
    /* Ensure positioning relative to container */
}

@media screen and (max-width: 900px) {
    .form-view {
        max-width: 100%;
        padding: 0 10px;
    }

    #annotationCanvasContainer {
        width: 100%;
        height: auto;
        max-width: 800px;
        max-height: 600px;
    }

    #annotationCanvasContainer canvas {
        width: 100% !important;
        max-width: 800px;
        height: auto !important;
        max-height: 600px;
    }
}

/* Media query for mobile devices (max-width: 768px) */
@media (max-width: 768px) {
    .tab-nav {
      display: flex;
      overflow-x: auto; /* Enable horizontal scrolling */
      justify-content: flex-start; /* Align tabs to the start */
      padding: 5px;
    }
  
    .tab-nav button {
      padding: 8px 12px; /* Reduce padding to make tabs more compact */
      font-size: 14px; /* Reduce font size for tab text */
      margin: 0 3px; /* Reduce margin between tabs */
    }
  
    /* Hide scrollbar for a cleaner look (optional) */
    .tab-nav::-webkit-scrollbar {
      display: none;
    }
  
    /* Ensure the tab-nav itself doesn't show scrollbars on other browsers */
    .tab-nav {
      -ms-overflow-style: none; /* IE and Edge */
      scrollbar-width: none; /* Firefox */
    }
  }

  /* New media query for landscape orientation */
@media (orientation: landscape) {
    .tab-nav {
      padding: 5px;
    }
  
    .tab-nav button {
      padding: 6px 10px; /* Slightly smaller padding in landscape to fit more tabs */
      font-size: 12px; /* Smaller font size for landscape */
    }
  
    /* Adjust form fields for landscape mode */
    .form-container {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
    }
  
    .form-container input,
    .form-container select {
      flex: 1 1 45%; /* Make form fields take up half the width in landscape */
      min-width: 200px;
    }
  }