/* ==================================================
   DRS RENT - RENTAL CONTRACTS CSS
   Ίδια λογική εμφάνισης με styleorders.css
   ================================================== */

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f7f6;
    margin: 0;
    padding: 20px;
    color: #333;
}

h1 {
    text-align: center;
    color: #4A90E2;
    margin-top: 40px;
    margin-bottom: 20px;
}

h2 {
    color: #333;
    margin-top: 0;
    margin-bottom: 14px;
}

a {
    font-size: 14px;
    color: #4A90E2;
    text-decoration: none;
    font-weight: bold;
}

a:hover {
    text-decoration: underline;
}


/* ==================================================
   ΓΕΝΙΚΑ TABLES
   ================================================== */

table {
    width: 90%;
    margin: 40px auto;
    border-collapse: collapse;
    background-color: #f9f9f9;
    border-radius: 8px;
    overflow-x: auto;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

table th,
table td {
    padding: 12px;
    border: 1px solid #ddd;
    text-align: left;
    font-size: 14px;
}

table th {
    background-color: #f1f1f1;
    color: #333;
}

table tr:nth-child(even) {
    background-color: #f2f2f2;
}

tr.clickable-row {
    cursor: pointer;
}

tr.clickable-row:hover {
    background-color: #f0f0f0;
}


/* ==================================================
   LIST CONTRACTS PAGE
   contracts.php
   ================================================== */

.top-actions {
    width: 90%;
    margin: 20px auto 0 auto;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}

.new-contract-btn {
    display: inline-block;
    padding: 10px 16px;
    background: #4A90E2;
    color: #ffffff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    box-shadow: 0 3px 8px rgba(74, 144, 226, 0.25);
}

.new-contract-btn:hover {
    background: #357bd1;
    text-decoration: none;
}


/* ==================================================
   CONTRACT VIEW PAGE
   view_contract.php
   ================================================== */

.contract-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 0 40px 0;
}

.contract-header {
    width: 90%;
    margin: 25px auto 20px auto;
    background: #ffffff;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 16px 18px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.06);
}

.contract-title h1 {
    text-align: left;
    margin: 0 0 8px 0;
    color: #4A90E2;
}

.contract-number {
    font-size: 18px;
    font-weight: 700;
    color: #333;
}

.small-note {
    color: #666;
    font-size: 12px;
    margin-top: 4px;
}

.actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}


/* ==================================================
   BUTTONS
   ================================================== */

.btn {
    display: inline-block;
    padding: 8px 13px;
    border: 0;
    border-radius: 7px;
    cursor: pointer;
    background: #ddd;
    color: #333;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}

.btn:hover {
    text-decoration: none;
    filter: brightness(0.97);
}

.btn-primary {
    background: #4A90E2;
    color: #fff;
}

.btn-success {
    background: #2e7d32;
    color: #fff;
}

.btn-danger {
    background: #e74c3c;
    color: #fff;
}

.btn-muted {
    background: #f3f3f3;
    color: #333;
}


/* ==================================================
   SECTIONS / CARDS
   ================================================== */

.section {
    width: 90%;
    margin: 20px auto;
    padding: 18px;
    border: 1px solid #eee;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.section h2 {
    border-bottom: 1px solid #eeeeee;
    padding-bottom: 8px;
    margin-bottom: 14px;
}


/* ==================================================
   INFO GRID
   ================================================== */

.info-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.info-box {
    background: #f7f7f7;
    border: 1px solid #eeeeee;
    border-radius: 8px;
    padding: 10px;
}

.info-label {
    font-size: 13px;
    color: #666666;
    margin-bottom: 4px;
}

.info-value {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    word-break: break-word;
}


/* ==================================================
   STATUS
   ================================================== */

.status-badge {
    display: inline-block;
    padding: 7px 12px;
    border-radius: 20px;
    font-weight: 700;
    background: #eeeeee;
    color: #333;
}

.status-draft {
    color: #b8860b;
}

.status-signed {
    color: #168a3a;
}

.status-cancelled {
    color: #b00020;
}

.status-amended {
    color: #6a4bc4;
}


/* Πιο όμορφα badges όταν μπαίνουν σε λίστα */
td.status-draft {
    color: #b8860b;
    font-weight: 700;
}

td.status-signed {
    color: #168a3a;
    font-weight: 700;
}

td.status-cancelled {
    color: #b00020;
    font-weight: 700;
}

td.status-amended {
    color: #6a4bc4;
    font-weight: 700;
}


/* ==================================================
   EMPTY / NOTES
   ================================================== */

.empty-message {
    color: #777;
    font-style: italic;
    padding: 10px 0;
}

.hint {
    color: #666;
    font-size: 12px;
}


/* ==================================================
   FORMS - για new_contract.php που θα φτιάξουμε
   ================================================== */

.contract-form {
    width: 90%;
    margin: 30px auto;
}

.form-section {
    margin-bottom: 22px;
    padding: 18px;
    border: 1px solid #eee;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.form-section h2 {
    border-bottom: 1px solid #eeeeee;
    padding-bottom: 8px;
    margin-bottom: 14px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-field label {
    font-size: 13px;
    color: #555;
    font-weight: 600;
}

.inp,
.contract-form input,
.contract-form select,
.contract-form textarea {
    width: 100%;
    padding: 7px 9px;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 14px;
    background: #fff;
    color: #333;
}

.contract-form textarea {
    min-height: 70px;
    resize: vertical;
}

.inp:focus,
.contract-form input:focus,
.contract-form select:focus,
.contract-form textarea:focus {
    outline: none;
    border-color: #4A90E2;
    box-shadow: 0 0 3px rgba(74,144,226,0.35);
}

.form-actions {
    margin-top: 24px;
    text-align: center;
}

.create-contract-btn {
    padding: 10px 18px;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    background: #4A90E2;
    color: #fff;
}

.create-contract-btn:hover {
    background: #357bd1;
}


/* ==================================================
   SIGNATURE PAGE - για sign_contract.php αργότερα
   ================================================== */

.signature-box {
    width: 90%;
    margin: 20px auto;
    padding: 18px;
    border: 1px solid #eee;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.signature-canvas-wrap {
    border: 2px dashed #ccc;
    border-radius: 10px;
    background: #fff;
    padding: 10px;
    margin-top: 10px;
}

#signaturePad {
    width: 100%;
    height: 220px;
    display: block;
    background: #fff;
    cursor: crosshair;
}

.check-list {
    display: grid;
    gap: 10px;
    margin: 15px 0;
}

.check-line {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: #f7f7f7;
    border: 1px solid #eeeeee;
    border-radius: 8px;
    padding: 10px;
}

.check-line input {
    margin-top: 3px;
}


/* ==================================================
   RESPONSIVE
   ================================================== */

@media (max-width: 1100px) {
    .info-grid,
    .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    body {
        padding: 12px;
    }

    table,
    .section,
    .contract-header,
    .contract-form,
    .signature-box,
    .top-actions {
        width: 100%;
    }

    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        margin: 25px auto;
    }

    .contract-header {
        flex-direction: column;
    }

    .actions {
        justify-content: flex-start;
    }

    .info-grid,
    .form-grid,
    .form-grid-2 {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 24px;
    }
}

/* ==================================================
   FIX ΓΙΑ TABLES ΜΕΣΑ ΣΤΗΝ ΚΑΡΤΕΛΑ ΣΥΜΒΑΣΗΣ
   ================================================== */

.contract-page .section table {
    width: 100%;
    margin: 12px 0 0 0;
    box-shadow: none;
}

.contract-page .section table th,
.contract-page .section table td {
    padding: 9px;
    font-size: 13px;
}

.contract-page .section table tr:nth-child(even) {
    background-color: #f7f7f7;
}

/* ==================================================
   TERMS BOX
   ================================================== */

.terms-box {
    max-height: 260px;
    overflow-y: auto;
    padding: 14px;
    background: #fafafa;
    border: 1px solid #eeeeee;
    border-radius: 8px;
    line-height: 1.5;
    font-size: 14px;
}

.terms-box p {
    margin-top: 0;
}

/* ==================================================
   SIGNATURE BUTTONS FIX
   ================================================== */

.signature-box .form-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ==================================================
   PHOTOS GRID
   ================================================== */

.photos-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.photo-card {
    background: #f7f7f7;
    border: 1px solid #eeeeee;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 7px rgba(0,0,0,0.05);
}

.photo-card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
    background: #e5e5e5;
}

.photo-info {
    padding: 10px;
    display: grid;
    gap: 4px;
}

.photo-info strong {
    color: #333;
    font-size: 14px;
}

.photo-info span {
    color: #555;
    font-size: 13px;
}

.photo-info small {
    color: #777;
    font-size: 12px;
}

@media (max-width: 1100px) {
    .photos-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .photos-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 480px) {
    .photos-grid {
        grid-template-columns: 1fr;
    }
}

/* ==================================================
   PHOTO UPLOAD BUTTONS
   ================================================== */

.photo-upload-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.selected-photo-lists {
    margin-top: 10px;
    display: grid;
    gap: 8px;
    font-size: 13px;
}

.file-list {
    list-style: none;
    padding: 0;
    margin: 5px 0 0 0;
}

.file-list li {
    background: #f3f7ff;
    border: 1px solid #dbeafe;
    border-radius: 6px;
    padding: 6px 8px;
    margin-bottom: 4px;
    color: #333;
    word-break: break-all;
}

/* ==================================================
   PHOTO CHECKLIST
   ================================================== */

.photo-checklist {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.photo-point-card {
    background: #f9f9f9;
    border: 1px solid #eeeeee;
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.photo-point-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.photo-point-head strong {
    font-size: 16px;
    color: #333;
}

.photo-point-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.photo-count {
    display: inline-block;
    margin-left: 8px;
    padding: 3px 7px;
    border-radius: 999px;
    background: #eaf7ef;
    color: #168a3a;
    font-size: 12px;
    font-weight: 700;
}

.photo-description-field {
    margin-bottom: 10px;
}

.selected-photo-lists {
    display: grid;
    gap: 6px;
    margin-top: 8px;
}

.file-list {
    list-style: none;
    padding: 0;
    margin: 4px 0 0 0;
}

.file-list li {
    background: #f3f7ff;
    border: 1px solid #dbeafe;
    border-radius: 6px;
    padding: 6px 8px;
    margin-bottom: 4px;
    color: #333;
    word-break: break-all;
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.file-list li button {
    border: 0;
    background: transparent;
    color: #b00020;
    font-weight: bold;
    cursor: pointer;
}

.mini-existing-photos {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.mini-existing-photos img {
    width: 64px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #ddd;
    background: #eee;
}

@media (max-width: 900px) {
    .photo-checklist {
        grid-template-columns: 1fr;
    }

    .photo-point-head {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ==================================================
   DRIVER DOCUMENTS
   ================================================== */

.driver-doc-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 16px;
}

.driver-doc-card {
    background: #f9f9f9;
    border: 1px solid #eeeeee;
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.driver-doc-card strong {
    font-size: 15px;
    color: #333;
}

@media (max-width: 900px) {
    .driver-doc-grid {
        grid-template-columns: 1fr;
    }
}

.driver-doc-note {
    margin-top: 14px;
    padding: 12px 14px;
    background: #f3f7ff;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    color: #333;
    font-size: 14px;
    line-height: 1.45;
}

/* ==================================================
   CONTRACTS LIST SEARCH / PAGINATION
   ================================================== */

.contracts-toolbar {
    width: 90%;
    margin: 20px auto 10px auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.contracts-search-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.contracts-search-form input,
.contracts-search-form select {
    height: 36px;
    padding: 6px 10px;
    border: 1px solid #d6d6d6;
    border-radius: 7px;
    box-sizing: border-box;
    font-size: 14px;
}

.contracts-search-form input {
    min-width: 340px;
}

.contracts-results-info {
    width: 90%;
    margin: 10px auto;
    color: #666;
    font-size: 13px;
}

.pagination {
    width: 90%;
    margin: 18px auto 40px auto;
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border-radius: 7px;
    border: 1px solid #d6d6d6;
    background: #ffffff;
    color: #333;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}

.pagination a:hover {
    background: #f3f7ff;
    border-color: #4A90E2;
    color: #1f7ae0;
}

.pagination .active-page {
    background: #4A90E2;
    border-color: #4A90E2;
    color: #ffffff;
}

@media (max-width: 768px) {
    .contracts-toolbar {
        align-items: stretch;
    }

    .contracts-search-form {
        width: 100%;
    }

    .contracts-search-form input,
    .contracts-search-form select,
    .contracts-search-form button,
    .contracts-search-form a {
        width: 100%;
    }

    .contracts-search-form input {
        min-width: 0;
    }
}

/* ==================================================
   DRAFT DISCARD / RESTORE
   ================================================== */

.danger-section {
    border-color: #f3b8b8 !important;
    background: #fff7f7 !important;
}

.warning-section {
    border-color: #f0d28a !important;
    background: #fffaf0 !important;
}

.status-discarded {
    color: #9a6700;
    font-weight: 700;
}

textarea {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid #d6d6d6;
    border-radius: 7px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
}

.danger-section {
    border-color: #f3b8b8 !important;
    background: #fff7f7 !important;
}

.warning-section {
    border-color: #f0d28a !important;
    background: #fffaf0 !important;
}

textarea {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid #d6d6d6;
    border-radius: 7px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
}

/* ==================================================
   CONTRACT MODALS
   ================================================== */

.actions button.btn {
    border: 0;
    cursor: pointer;
    font-family: inherit;
}

.contract-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.45);
}

.contract-modal-card {
    width: min(94vw, 520px);
    background: #ffffff;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.25);
}

.contract-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.contract-modal-header h2 {
    margin: 0;
}

.contract-modal-close {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: #eeeeee;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

.contract-modal-close:hover {
    background: #dddddd;
}

.contract-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

.contract-modal-card textarea {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid #d6d6d6;
    border-radius: 7px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
}

@media (max-width: 600px) {
    .contract-modal-actions {
        flex-direction: column;
    }

    .contract-modal-actions .btn {
        width: 100%;
        text-align: center;
    }
}

.terms-preview {
    background: #ffffff;
    border: 1px solid #dde3ec;
    border-radius: 14px;
    padding: 24px;
    line-height: 1.65;
    color: #1f2937;
}

.terms-preview h2,
.terms-preview h3 {
    margin-top: 18px;
    margin-bottom: 10px;
    color: #111827;
}

.terms-preview p {
    margin: 0 0 12px 0;
}