/* Marine Inspection Report Generator CSS */

:root {
    --primary-color: #1E4D87;
    --primary-light: #3A6DA0;
    --secondary-color: #C4DCF2;
    --secondary-light: #E7F2FB;
    --accent-color: #FF8C00;
    --light-gray: #f5f5f5;
    --dark-gray: #333;
    --border-color: #ccc;
    --success-color: #28a745;
    --error-color: #dc3545;
    --warning-color: #ffc107;
}

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

body {
    font-family: 'Calibri', Arial, sans-serif;
    color: var(--dark-gray);
    line-height: 1.6;
    background-color: #f9f9f9;
}

header {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.logo {
    position: relative;
    max-width: 200px;
}

.logo img {
    max-height: 60px;
}

.logo-upload-btn {
    position: absolute;
    bottom: -25px;
    left: 0;
    font-size: 0.8rem;
    padding: 3px 8px;
    background-color: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    cursor: pointer;
}

.client-logo {
    text-align: right;
}

h1 {
    font-size: 1.8rem;
    margin: 0;
    text-align: center;
    flex-grow: 1;
}

h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--secondary-color);
}

h3 {
    color: var(--primary-color);
    margin: 1.5rem 0 1rem;
}

h4 {
    color: var(--primary-light);
    margin: 1rem 0 0.5rem;
}

.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* Tabs */
.tabs {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    background-color: transparent;
    border: none;
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    font-weight: bold;
    color: var(--dark-gray);
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.tab-btn:hover {
    color: var(--primary-color);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom: 3px solid var(--primary-color);
}

.tab-content {
    background-color: white;
    border-radius: 0 0 5px 5px;
    padding: 1.5rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    min-height: 500px;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Form Styles */
.form-group {
    margin-bottom: 1rem;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-row .form-group {
    flex: 1;
    min-width: 150px;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-control:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(30, 77, 135, 0.1);
}

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

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath fill='%23333' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: white;
    color: var(--dark-gray);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn:hover {
    background-color: var(--light-gray);
}

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

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

.button-group {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Component Sections */
.component-list {
    width: 30%;
    min-width: 250px;
    border-right: 1px solid var(--border-color);
    padding-right: 1.5rem;
}

.component-details {
    width: 70%;
    padding-left: 1.5rem;
}

#components {
    display: flex;
    gap: 2rem;
}

.component-item {
    margin-bottom: 0.5rem;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--secondary-light);
    transition: all 0.3s ease;
    cursor: pointer;
}

.component-item:hover {
    border-color: var(--primary-light);
    background-color: var(--secondary-color);
}

.component-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.component-name {
    font-weight: bold;
}

.select-message {
    color: var(--dark-gray);
    font-style: italic;
    text-align: center;
    margin-top: 2rem;
}

/* File Dropzones */
.dropzone {
    border: 2px dashed var(--border-color);
    border-radius: 4px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: var(--light-gray);
    margin-bottom: 1rem;
}

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

.dz-message {
    color: var(--dark-gray);
}

.preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
}

.preview-item {
    position: relative;
    width: 150px;
    height: 150px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

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

.preview-item .remove-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: rgba(220, 53, 69, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Rating Entry */
.rating-entry {
    background-color: var(--secondary-light);
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

/* Reference Tables */
.reference-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 2rem;
}

.reference-table th, .reference-table td {
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    text-align: left;
}

.reference-table th {
    background-color: var(--primary-color);
    color: white;
}

.reference-table tr:nth-child(even) {
    background-color: var(--secondary-light);
}

/* Signature Pad */
.signature-pad {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

canvas#signaturePad {
    width: 100%;
    height: 200px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 2rem;
    border-radius: 5px;
    width: 60%;
    max-width: 600px;
    position: relative;
}

.preview-content {
    width: 80%;
    max-width: 1000px;
    max-height: 80vh;
    overflow-y: auto;
}

.close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
}

.report-preview {
    border: 1px solid var(--border-color);
    padding: 2rem;
    margin: 1rem 0;
    background-color: white;
}

/* Report Specific Styles */
.cover-page {
    text-align: center;
    padding: 2rem;
}

.cover-page h1 {
    font-size: 28px;
    color: #365F91;
    text-transform: uppercase;
    margin: 100px 0 1rem;
}

.cover-page h2 {
    font-size: 22px;
    color: #365F91;
    text-transform: uppercase;
    border-bottom: none;
}

.cover-image {
    max-width: 100%;
    height: auto;
    margin: 2rem 0;
}

/* Table of Contents */
.toc {
    margin: 2rem 0;
}

.toc-item {
    display: flex;
    margin-bottom: 0.5rem;
}

.toc-number {
    width: 30px;
    flex-shrink: 0;
}

.toc-title {
    flex-grow: 1;
    text-transform: uppercase;
    font-size: 14px;
}

/* Project Particulars Table */
.particulars-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

.particulars-table th {
    background-color: #365F91;
    color: white;
    padding: 5px;
    text-align: left;
    border: 1px solid #000;
}

.particulars-table td {
    padding: 5px;
    border: 1px solid #000;
}

.particulars-table tr:first-child th {
    height: 40px;
}

/* Executive Summary */
.executive-summary {
    margin: 2rem 0;
}

/* General Arrangement */
.general-arrangement img {
    width: 100%;
    height: auto;
    transform: rotate(90deg);
    transform-origin: center center;
}

/* Component Sections */
.component-section {
    margin: 2rem 0;
}

.component-section h3 {
    color: #365F91;
    margin-bottom: 1rem;
}

.component-observations {
    margin: 1rem 0;
}

.component-ratings-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

.component-ratings-table th {
    background-color: #365F91;
    color: white;
    text-align: left;
    padding: 8px;
    border: 1px solid #000;
}

.component-ratings-table td {
    padding: 8px;
    border: 1px solid #000;
}

.component-photos {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 1.5rem 0;
}

.component-photo {
    width: 300px;
}

.component-photo img {
    width: 100%;
    height: auto;
}

/* IMS Declaration */
.ims-declaration {
    border: 1px solid #ccc;
    padding: 15px;
    margin: 2rem 0;
}

.ims-declaration h4 {
    text-align: center;
    background-color: #365F91;
    color: white;
    padding: 10px;
    margin-top: 0;
}

.signature-image {
    max-width: 300px;
    height: auto;
    margin: 1rem 0;
}

/* Document Status */
.document-status {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
}

.document-status th {
    background-color: #365F91;
    color: white;
    padding: 5px;
    border: 1px solid #000;
}

.document-status td {
    padding: 5px;
    border: 1px solid #000;
}

/* Copyright Notice */
.copyright-notice {
    border: 1px solid #000;
    margin: 2rem 0;
}

.copyright-notice th {
    background-color: #365F91;
    color: white;
    text-align: center;
    padding: 5px;
    border: 1px solid #000;
}

.copyright-notice td {
    padding: 5px;
    border: 1px solid #000;
}

/* End of report */
.end-of-report {
    text-align: center;
    margin: 3rem 0;
}

.end-of-report h2 {
    color: #365F91;
    border-bottom: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .tabs {
        flex-direction: column;
    }
    
    .form-row {
        flex-direction: column;
    }

    .form-row .form-group {
        width: 100%;
    }

    #components {
        flex-direction: column;
    }

    .component-list, .component-details {
        width: 100%;
        padding: 0;
        border: none;
    }

    .component-list {
        margin-bottom: 2rem;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 1rem;
    }

    .button-group {
        flex-direction: column;
    }

    .modal-content {
        width: 90%;
        margin: 15% auto;
    }
}

/* Print Styles */
@media print {
    body {
        background-color: white;
        margin: 0;
        padding: 0;
        font-family: 'Calibri', Arial, sans-serif;
        font-size: 12pt;
        width: 210mm;
        height: 297mm;
    }

    .container {
        max-width: 100%;
        margin: 0;
        padding: 0;
    }

    .tabs, .button-group, .btn, header {
        display: none;
    }

    .tab-pane {
        display: block;
    }

    .tab-content {
        box-shadow: none;
        padding: 0;
    }

    .page {
        page-break-after: always;
        margin: 0;
        padding: 15mm;
    }

    h1 {
        font-size: 28px;
        color: #365F91;
    }

    h2 {
        font-size: 22px;
        color: #365F91;
    }

    h3 {
        font-size: 18px;
        color: #365F91;
    }

    h4 {
        font-size: 16px;
        color: #365F91;
    }

    table {
        page-break-inside: avoid;
    }

    img {
        max-width: 100%;
    }

    .preview-item .remove-btn {
        display: none;
    }
}