:root {
    --primary-color: #000000;
    /* Black for strong contrast/buttons */
    --secondary-color: #1d1d1f;
    /* Dark gray for headings */
    --accent-color: #0066cc;
    /* Subtle blue for links/active states */
    --background-color: #f5f5f7;
    /* Light gray background common in modern designs */
    --card-background: #ffffff;
    --text-color: #424245;
    /* Softer gray for body text */
    --border-color: #d2d2d7;
    --success-color: #34c759;
    --transition-speed: 0.3s;
    --border-radius: 18px;
    /* Larger border radius for modern feel */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    color: var(--text-color);
    line-height: 1.5;
    display: flex;
    justify-content: center;
    padding: 40px 20px;
}

.container {
    width: 100%;
    max-width: 980px;
    /* Slightly wider */
    background: var(--card-background);
    padding: 3rem;
    /* More whitespace */
    border-radius: var(--border-radius);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    /* Softer, deeper shadow */
    margin-bottom: 3rem;
}

/* Header Styles */
header {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

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

.header-branding {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-align: left;
}

.header-user {
    text-align: right;
    font-size: 0.9rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

header p {
    font-size: 1.1rem;
    color: #86868b;
}

/* BRS Summary Box */
.brs-summary {
    background-color: #1d3b46;
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 3rem;
    line-height: 1.6;
    font-size: 0.95rem;
    border: 1px solid #2c5260;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-align: justify;
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
    }

    .header-branding {
        flex-direction: column;
        text-align: center;
    }

    .header-user {
        text-align: center;
    }

    header h1 {
        font-size: 2rem;
    }
}

.survey-section {
    display: flex;
    gap: 3rem;
    /* More space between content and image */
    margin-bottom: 3rem;
    opacity: 1;
    transform: translateY(0);
    transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
    /* Smoother bezier */
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 3rem;
}

.survey-section.hidden {
    display: none;
    opacity: 0;
    transform: translateY(20px);
}

.survey-section.collapsed {
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid transparent;
    /* Hide border when collapsed for cleaner look */
}

.survey-section.collapsed .content>*:not(h2) {
    display: none;
}

.survey-section.collapsed .image-placeholder {
    display: none;
}

.survey-section.collapsed h2 {
    margin-bottom: 0;
    cursor: pointer;
    color: var(--secondary-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.25rem;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.survey-section.collapsed h2:hover {
    opacity: 1;
}

.survey-section.collapsed h2::after {
    content: 'Editar';
    font-size: 0.9rem;
    color: var(--accent-color);
    font-weight: 500;
    background: #f0f0f5;
    padding: 4px 12px;
    border-radius: 20px;
}

.survey-section:last-child {
    border-bottom: none;
}

.content {
    flex: 3;
    /* Give more space to content */
}

.image-placeholder {
    flex: 2;
    background-color: #f5f5f7;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 250px;
    color: #86868b;
    font-weight: 500;
    font-size: 0.9rem;
    border: 1px solid rgba(0, 0, 0, 0.02);
}

h2 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    color: var(--secondary-color);
    font-weight: 600;
    letter-spacing: -0.01em;
}

h3 {
    font-size: 1.25rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--secondary-color);
    font-weight: 600;
}

.form-group {
    margin-bottom: 2rem;
}

label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 500;
    color: var(--secondary-color);
}

input[type="text"],
input[type="number"],
input[type="password"],
textarea {
    width: 100%;
    padding: 1rem;
    /* Larger padding */
    border: 1px solid var(--border-color);
    border-radius: 12px;
    /* Rounded inputs */
    font-family: inherit;
    font-size: 1rem;
    background-color: rgba(255, 255, 255, 0.8);
    transition: all 0.2s;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.1);
}

textarea {
    min-height: 120px;
    resize: vertical;
}

.radio-group,
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.radio-group label,
.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 400;
    cursor: pointer;
    padding: 0.5rem 0;
}

input[type="radio"],
input[type="checkbox"] {
    accent-color: var(--primary-color);
    width: 1.2em;
    height: 1.2em;
}

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

.next-btn,
.submit-btn,
.submit-btn2,
.prev-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 980px;
    /* Pill shape */
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
    margin-top: 1rem;
    min-width: 120px;
}

.prev-btn {
    background-color: #e8e8ed;
    color: var(--secondary-color);
}

.next-btn:hover,
.submit-btn:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

.prev-btn:hover {
    background-color: #d2d2d7;
}

/* Sortable Lists */
.sortable-list {
    list-style: none;
    padding: 0;
    margin-bottom: 1.5rem;
    counter-reset: priority-counter;
}

.sortable-list li {
    background: white;
    border: 1px solid var(--border-color);
    padding: 1rem 1.25rem 1rem 3.5rem;
    margin-bottom: 0.75rem;
    border-radius: 12px;
    cursor: grab;
    display: flex;
    align-items: center;
    transition: all 0.2s;
    font-weight: 500;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
    position: relative;
    counter-increment: priority-counter;
}

.sortable-list li::before {
    content: counter(priority-counter);
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--primary-color);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
}

.sortable-list li:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
    border-color: #b0b0b5;
}

.sortable-list li:active {
    cursor: grabbing;
}

/* Utilities */
.hidden {
    display: none !important;
}

@media (max-width: 768px) {
    .survey-section {
        flex-direction: column;
    }

    .image-placeholder {
        min-height: 180px;
        order: -1;
        /* Image on top on mobile */
        margin-bottom: 1.5rem;
    }

    .container {
        padding: 1.5rem;
    }
}

/* Modal Styles */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    display: none !important;
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background-color: var(--card-background);
    padding: 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 400px;
    width: 90%;
    animation: modalSlideIn 0.3s ease-out;
}

.modal-content h2 {
    margin-bottom: 1rem;
    color: var(--secondary-color);
}

.modal-content p {
    margin-bottom: 2rem;
    color: var(--text-color);
}

@keyframes modalSlideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Explanation text styling for Section 5 */
.explanation-text {
    display: block;
    font-style: italic;
    font-size: calc(1em - 1pt);
    margin-top: 0.25rem;
}

/* Styling for 'Otro:' input fields in sortable lists */
.sortable-list li.other-option input[type="text"] {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
    font-size: 0.9rem;
    font-family: inherit;
    width: 250px;
    margin-left: 0.5rem;
    background-color: white;
    transition: border-color 0.2s;
}

.sortable-list li.other-option input[type="text"]:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.1);
}

.sortable-list li.other-option {
    display: flex;
    align-items: center;
}

/* Deck Link Styling */
.deck-link {
    display: inline-block;
    background-color: var(--accent-color);
    color: white;
    padding: 2px 10px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9em;
    transition: background-color 0.2s, transform 0.1s;
    vertical-align: middle;
    margin: 0 4px;
}

.deck-link:hover {
    background-color: #004499;
    transform: translateY(-1px);
    text-decoration: none;
}