/* --- Reset & Base Styles --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    background-color: #f8f9fa; /* Light grey background */
    color: #343a40; /* Dark grey text */
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 30px auto;
    padding: 20px;
    background-color: #ffffff; /* White container background */
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.generator-container {
     max-width: 700px;
}

/* --- Header --- */
.form-header {
    display: flex;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.logo {
    max-height: 60px; /* Ajusta según tu logo */
    margin-right: 20px;
}

.form-header h1 {
    color: #0056b3; /* Primary blue */
    font-size: 1.8em;
    font-weight: 600;
}

.form-header h1 i {
    margin-right: 10px;
    color: #007bff; /* Brighter blue for icon */
}

/* --- Cards --- */
.card {
    background-color: #ffffff;
    border: 1px solid #e9ecef; /* Light border */
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.3s ease;
}

.card:hover {
     box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
}

.card h2, .card h3, .card h4 {
    color: #0056b3; /* Primary blue */
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    font-weight: 600;
}
.card h2 i, .card h3 i {
    margin-right: 8px;
     color: #007bff;
}
.card h4 {
    font-size: 1.1em;
    color: #17a2b8; /* Info blue/cyan */
    border-bottom: none;
    margin-top: 15px;
}

.readonly-card {
    background-color: #eef2f7; /* Slightly different background for readonly */
    border-left: 4px solid #17a2b8; /* Info blue accent */
}

.readonly-card input[readonly] {
    background-color: #dfe9f5;
    border: 1px solid #ced4da;
    cursor: default;
    font-weight: 500;
     color: #495057;
}

/* --- Form Elements --- */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057; /* Medium grey */
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ced4da; /* Standard border */
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #80bdff; /* Highlight blue on focus */
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #6c757d; /* Grey for helper text */
    font-size: 0.85em;
}

.required {
    color: #dc3545; /* Red for required */
    margin-left: 2px;
}

.error-message {
    color: #dc3545;
    font-size: 0.85em;
    margin-top: 5px;
    display: block; /* Ensure it takes space */
}

input:invalid {
  /* Add subtle indication for browser-native validation errors */
  /* border-color: #dc3545; */
}


/* Form Rows for side-by-side fields */
.form-row {
    display: flex;
    flex-wrap: wrap;
    margin-left: -10px;
    margin-right: -10px;
}

.form-row .form-group {
    flex: 1 1 0; /* Allow flexible sizing */
    padding-left: 10px;
    padding-right: 10px;
    min-width: 180px; /* Prevent fields from becoming too narrow */
}

/* Specific widths for Calle/Numero */
.form-group-street { flex-grow: 3; } /* Calle takes more space */
.form-group-number { flex-grow: 1; min-width: 80px !important;} /* Numero takes less */


/* --- Buttons --- */
.btn {
    display: inline-block;
    font-weight: 600;
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    border: 1px solid transparent;
    padding: 12px 25px;
    font-size: 1em;
    border-radius: 6px;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    text-decoration: none; /* For link buttons */
}
.btn i { margin-right: 8px; }

.btn-primary {
    color: #fff;
    background-color: #007bff; /* Primary blue */
    border-color: #007bff;
}

.btn-primary:hover {
    background-color: #0056b3;
    border-color: #004085;
}

.btn-secondary {
    color: #fff;
    background-color: #6c757d; /* Grey */
    border-color: #6c757d;
}

.btn-secondary:hover {
    background-color: #5a6268;
    border-color: #545b62;
}
.btn-danger {
    color: #fff;
    background-color: #dc3545; /* Red */
    border-color: #dc3545;
    padding: 3px 8px;
    font-size: 0.8em;
    margin-left: 10px;
}
.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}


.btn-small {
    padding: 8px 15px;
    font-size: 0.9em;
}

.btn-submit {
    width: 100%;
    padding: 15px;
    font-size: 1.1em;
    margin-top: 15px;
}

/* --- File Upload --- */
.drop-zone {
    border: 2px dashed #007bff;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    background-color: #f8f9fa;
    transition: background-color 0.3s ease;
    margin-bottom: 15px;
}

.drop-zone.dragover {
    background-color: #e2e6ea;
    border-color: #0056b3;
}

.drop-zone-text {
    color: #6c757d;
    font-weight: 500;
}

.preview-container {
    margin-top: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.preview-item {
    display: flex;
    align-items: center;
    background-color: #e9ecef;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9em;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.preview-item img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    margin-right: 10px;
    border-radius: 4px;
}
.preview-item .file-icon {
    font-size: 1.5em;
    margin-right: 10px;
    color: #6c757d;
}

.preview-item span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px; /* Adjust as needed */
    margin-right: 10px;
}


/* --- Cláusulas --- */
.clausula-item {
    border: 1px solid #eee;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 6px;
    background-color: #fdfdfd;
     position: relative;
}
.clausula-item h4 {
     margin-top: 0;
     margin-bottom: 15px;
     padding-bottom: 5px;
     border-bottom: 1px solid #eee;
     color: #6c757d;
     font-size: 1em;
}

.remove-clausula-btn {
    position: absolute;
    top: 10px;
    right: 10px;
}


/* --- Payment Section --- */
.payment-details {
    border: 1px solid #e0e0e0;
    padding: 20px;
    margin-top: 15px;
    border-radius: 6px;
    background-color: #f8f9fa;
}
.payment-details h4 {
    margin-top: 0;
    color: #0056b3;
    font-size: 1.1em;
}
.secure-text {
    font-style: italic;
    color: #28a745; /* Green for security text */
    margin-bottom: 15px;
    font-size: 0.95em;
}
.secure-text i {
    margin-right: 5px;
}

/* --- Confirmation --- */
.confirmation-checkbox {
    display: flex;
    align-items: center;
    margin-top: 20px;
    background-color: #eef2f7;
    padding: 15px;
    border-radius: 6px;
}
.confirmation-checkbox input[type="checkbox"] {
    margin-right: 15px;
    width: 1.3em;
    height: 1.3em;
    cursor: pointer;
}
.confirmation-checkbox label {
    margin-bottom: 0;
    font-weight: normal;
     color: #343a40;
}

.info-box {
    background-color: #fff3cd; /* Warning yellow background */
    border: 1px solid #ffeeba;
    border-left: 4px solid #ffc107; /* Warning yellow accent */
    padding: 15px;
    margin-top: 20px;
    border-radius: 6px;
}
.info-box h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #856404; /* Darker yellow text */
    font-weight: 600;
}
.info-box p {
    margin-bottom: 0;
     color: #856404;
     font-size: 0.95em;
}

/* --- Generator Result Area --- */
.result-card {
    margin-top: 30px;
    background-color: #e2f0d9; /* Light green background */
    border-left: 4px solid #28a745; /* Green accent */
}
.result-card h2 {
    color: #155724; /* Dark green */
}
.result-card textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #c3e6cb;
    border-radius: 6px;
    font-family: monospace;
    margin-bottom: 10px;
    background-color: #f8f9fa;
    resize: none;
}
.copy-feedback {
    color: #155724; /* Dark green */
    font-weight: bold;
    margin-top: 10px;
    font-size: 0.9em;
    height: 1.2em; /* Reserve space */
}

/* --- Confirmation Page --- */
.confirmation-container {
     max-width: 650px;
     text-align: center;
}
.confirmation-card {
     padding: 40px;
}
.confirmation-icon {
    font-size: 5em;
    color: #28a745; /* Success green */
    margin-bottom: 20px;
}
.confirmation-card h1 {
    color: #155724; /* Dark green */
    margin-bottom: 15px;
}
.confirmation-card p {
     color: #343a40;
     margin-bottom: 20px;
     font-size: 1.1em;
}

#summary-details {
    text-align: left;
    margin: 25px auto;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    max-width: 500px; /* Center the summary box */
}
#summary-details h2 {
     text-align: center;
     color: #0056b3;
     margin-bottom: 15px;
     font-size: 1.3em;
}
#summary-details p {
     margin-bottom: 8px;
     font-size: 1em;
     color: #495057;
}
#summary-details strong {
     color: #343a40;
}
#summary-details hr {
    margin: 15px 0;
    border: 0;
    border-top: 1px solid #e0e0e0;
}

.confirmation-card .info-box {
     text-align: left;
     max-width: 500px;
     margin: 20px auto; /* Center the info box */
}


/* --- Responsiveness --- */
@media (max-width: 768px) {
    .container {
        margin: 15px auto;
        padding: 15px;
    }
    .form-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .form-header h1 {
        font-size: 1.5em;
        margin-top: 10px;
    }
    .logo {
        max-height: 50px;
    }
    .form-row {
        margin-left: 0;
        margin-right: 0;
    }
    .form-row .form-group {
        padding-left: 0;
        padding-right: 0;
        flex-basis: 100%; /* Stack fields vertically on smaller screens */
    }
    .form-group-street, .form-group-number {
        flex-grow: 1; /* Reset specific grow factors */
        min-width: auto !important;
    }
     .preview-item span {
        max-width: 100px; /* Adjust for smaller screens */
    }
}

@media (max-width: 480px) {
     .form-header h1 {
        font-size: 1.3em;
    }
    .btn {
        padding: 10px 15px;
        font-size: 0.95em;
    }
    .btn-submit {
        padding: 12px;
        font-size: 1em;
    }
    .drop-zone {
        padding: 20px;
    }
    .card {
        padding: 15px;
    }
    h2 { font-size: 1.4em; }
    h3 { font-size: 1.2em; }
    h4 { font-size: 1.0em; }
}

/* Error state for inputs (using JS to add class) */
.input-error {
    border-color: #dc3545 !important; /* Red border */
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important; /* Red glow */
}