/* BASE & LAYOUT STYLES */
body {
    font-family: sans-serif;
    background-color: #c52a30;
    padding: 30px;
    color: #333;
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.wrapper {
    max-width: 900px;
    margin: 0 auto 60px auto;
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    flex: 1;
    position: relative; /* Anchor point for absolute language selector */
    width: 100%;
    box-sizing: border-box;
}

h2 {
    border-bottom: 2px solid #c52a30;
    padding-bottom: 8px;
    color: #c52a30;
    margin-top: 0;
    padding-right: 100px; /* Leave space so title text never collides with top-right selector */
}

h3 {
    border-bottom: 2px solid #c52a30;
    padding-bottom: 8px;
    color: #c52a30;
}

/* LANGUAGE SWITCHER - FIXED TOP RIGHT CORNER */
.lang-switch {
    position: absolute;
    top: 30px;
    right: 30px;
    display: flex;
    gap: 8px;
    z-index: 10;
}

.lang-btn {
    background: #e9ecef;
    border: 1px solid #ced4da;
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.lang-btn.active {
    background: #c52a30;
    color: white;
    border-color: #c52a30;
}

.lang-el {
    display: inline;
}

h3 .lang-el, 
h2 .lang-el, 
div .lang-el {
    display: block;
}

.lang-hidden {
    display: none !important;
}

/* FORM FIELDS & GRID SYSTEM */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
    width: 100%;
}

.field-group {
    display: flex;
    flex-direction: column;
}

.inline-input-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.inline-input-group input {
    flex: 1;
}

label {
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 14px;
}

input, 
textarea {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    width: 100%;
    box-sizing: border-box;
}

#ibanInput {
    letter-spacing: 1px;
    transition: border-color 0.2s ease, background-color 0.2s ease;
    border: 1px solid #ccc;
}

/* Address Auto-Lookup Feedback Message */
.address-status-msg {
    font-size: 0.85rem;
    margin-top: -5px;
    margin-bottom: 12px;
    font-weight: 500;
}

/* EXPENSE TABLES & TOTALS */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 15px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

th, td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

th {
    background-color: #f1f3f5;
}

.total-box {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    font-size: 18px;
    font-weight: bold;
    margin-top: 10px;
    gap: 10px;
}

.total-box input {
    width: 150px;
    font-weight: bold;
    background-color: #e9ecef;
    border: 1px solid #ccc;
    padding: 8px;
    border-radius: 4px;
    text-align: right;
}

/* FILE UPLOAD & DRAG & DROP ZONE */
.upload-zone {
    border: 2px dashed #c52a30;
    padding: 20px;
    border-radius: 4px;
    background: #fdfdfd;
    text-align: center;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    width: 100%;
    box-sizing: border-box;
}

.upload-zone.dragover {
    background: #e1f0ff;
    border-color: #0056b3;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    background: #e9ecef;
    padding: 6px 10px;
    margin-bottom: 5px;
    border-radius: 4px;
}

.file-item span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.remove-file-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
    flex-shrink: 0;
}

ul.file-list,
#selectedFilesList {
    margin: 5px 0 0 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

/* SIGNATURE COMPONENT (TABS & CANVAS) */
.sig-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 5px;
}

.sig-tab {
    background: #e9ecef;
    border: 1px solid #ced4da;
    padding: 4px 12px;
    font-size: 12px;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    border-bottom: none;
}

.sig-tab.active {
    background: #fafafa;
    border-color: #ccc;
    font-weight: bold;
    position: relative;
    z-index: 2;
    margin-bottom: -1px;
}

.sig-content {
    display: none;
}

.sig-content.active {
    display: block;
}

.canvas-container {
    border: 2px dashed #ccc;
    background: #fafafa;
    position: relative;
    border-radius: 0 4px 4px 4px;
    width: 100%;
    height: 180px;
    box-sizing: border-box;
    margin-top: -4px;
}

canvas {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    touch-action: none;
}

.file-sig-container {
    border: 2px dashed #ccc;
    background: #fafafa;
    border-radius: 0 4px 4px 4px;
    width: 100%;
    height: 180px;
    box-sizing: border-box;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin-top: -4px;
}

.canvas-controls {
    margin-top: 5px;
    text-align: right;
}

/* BUTTONS & UI CONTROLS */
.btn-utility {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    white-space: nowrap;
}

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

.btn-clear {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
}

.action-buttons-container {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

button.btn-submit {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

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

button.btn-reset-all {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

button.btn-reset-all:hover {
    background-color: #c82333;
}

/* BILINGUAL TOOLTIP HOVER WIDGET */
.info-tooltip {
    position: relative;
    cursor: pointer;
    display: inline-block;
    margin-left: 6px;
    font-size: 0.85em;
    user-select: none;
}

.info-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 130%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #2c3e50;
    color: #ffffff;
    padding: 6px 10px;
    border-radius: 5px;
    font-size: 0.8rem;
    font-weight: normal;
    white-space: nowrap;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.15);
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
    z-index: 1000;
    pointer-events: none;
}

.info-tooltip::before {
    content: '';
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: #2c3e50 transparent transparent transparent;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
    z-index: 1000;
}

.info-tooltip:hover::after,
.info-tooltip:hover::before {
    visibility: visible;
    opacity: 1;
}

/* MODALS, ALERTS & FOOTER */
.alert {
    background-color: #f8d7da;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.privacy-link-container {
    margin-top: 25px;
    font-size: 13px;
    color: #6c757d;
}

.privacy-link {
    color: #c52a30;
    text-decoration: underline;
    cursor: pointer;
    font-weight: bold;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    max-width: 650px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    position: relative;
    line-height: 1.5;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
}

.close-modal:hover {
    color: #333;
}

footer {
    background-color: #343a40;
    color: #ffffff;
    text-align: center;
    padding: 15px 0;
    font-size: 14px;
    width: 100%;
    margin-top: auto;
    border-radius: 6px;
}

/* STEP-BY-STEP PROCESS */
.steps-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin: 20px 0 30px 0;
    padding-bottom: 25px;
    border-bottom: 2px solid #f1f3f5;
}

.step-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.step-circle {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 3px solid #c52a30;
    background-color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    box-shadow: 0 2px 6px rgba(197, 42, 48, 0.12);
    transition: transform 0.2s ease, border-color 0.2s ease;
    flex-shrink: 0;
}

.step-card:hover .step-circle {
    transform: translateY(-2px);
    border-color: #a01f24;
}

.step-circle svg {
    width: 24px;
    height: 24px;
    color: #2c3e50;
}

.step-title {
    font-size: 13px;
    font-weight: bold;
    color: #111111;
    margin: 0 0 4px 0;
    line-height: 1.25;
    border-bottom: none !important;
    padding-bottom: 0 !important;
}

.step-desc {
    font-size: 11px;
    color: #666666;
    margin: 0;
    line-height: 1.35;
}

/* Enable smooth scrolling page-wide */
html {
    scroll-behavior: smooth;
}

/* Specific link styling inside step descriptions */
.step-link {
    color: #c52a30;
    text-decoration: underline;
    font-weight: bold;
}

.step-link:hover {
    color: #a01f24;
}

/* LOADING LIGHTBOX MODAL */
.loading-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.loading-modal-overlay.active {
    display: flex;
}

.loading-modal-content {
    background: #ffffff;
    padding: 30px 40px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
    text-align: center;
    max-width: 400px;
    width: 85%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Spinner Animation */
.loading-spinner {
    width: 48px;
    height: 48px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #c52a30;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.back-to-top-container {
    text-align: center;
    margin-top: 20px;
}

.back-to-top-btn {
    font-size: 13px;
    font-style: italic;
    color: #c52a30;
    text-decoration: none;
}

.back-to-top-btn:hover {
    color: #a01f24;
    text-decoration: underline;
}

.footer-link {
    color: #fff;
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.2s ease;
}

.footer-link:hover {
    color: #c52a30;
}

/* MOBILE RESPONSIVE MEDIA QUERIES */
@media screen and (max-width: 768px) {
    body {
        padding: 10px;
    }

    .wrapper {
        padding: 15px;
        width: 100%;
        box-sizing: border-box;
    }

    .lang-switch {
        top: 15px;
        right: 15px;
    }

    .grid-2 {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .steps-container {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }

    .step-card {
        width: 100%;
        box-sizing: border-box;
    }

    .total-box {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .total-box input {
        width: 100%;
    }

    .action-buttons-container {
        flex-direction: column-reverse;
        gap: 10px;
    }

    .action-buttons-container button {
        width: 100%;
        min-height: 48px;
        font-size: 1rem;
    }

    #sigCanvas {
        touch-action: none;
        width: 100%;
        height: 180px;
    }

    table th, table td {
        padding: 8px 6px;
        font-size: 0.85rem;
    }

    input[type="text"],
    input[type="email"],
    input[type="number"],
    input[type="date"],
    textarea {
        font-size: 16px !important;
    }

    .modal-content {
        width: 92%;
        padding: 18px;
        max-height: 85vh;
        overflow-y: auto;
    }
}

@media (max-width: 600px) {
    h2 {
        padding-right: 90px;
        font-size: 1.4rem;
    }

    .steps-container {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px 10px;
    }
}
