/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header styles */
.header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.header-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-content p {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
    margin-bottom: 20px;
}

.header-actions {
    margin-top: 20px;
}

.dashboard-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    text-decoration: none;
    padding: 12px 20px;
    border-radius: 10px;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.dashboard-link:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

/* Main content */
.main-content {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    overflow: hidden;
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Survey selector */
.survey-selector {
    padding: 40px;
}

.survey-selector h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 30px;
    color: #2d3748;
}

.survey-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

.survey-card {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    padding: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.survey-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.survey-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    border-color: #667eea;
}

.survey-card:hover::before {
    transform: scaleX(1);
}

.card-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    color: white;
    font-size: 1.5rem;
}

.survey-card h3 {
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: #2d3748;
    font-weight: 600;
}

.survey-card p {
    color: #718096;
    margin-bottom: 20px;
    line-height: 1.6;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: #a0aec0;
}

.estimated-time, .questions-count {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Survey container */
.survey-container {
    padding: 40px;
}

.survey-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.back-btn {
    background: none;
    border: 2px solid #e2e8f0;
    color: #718096;
    padding: 12px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.back-btn:hover {
    border-color: #667eea;
    color: #667eea;
    background: #f7fafc;
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.progress-bar {
    width: 200px;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    font-weight: 600;
    color: #2d3748;
    min-width: 40px;
}

/* Survey form */
.survey-form {
    margin-bottom: 30px;
}

.question-container {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 20px;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.question-header {
    margin-bottom: 25px;
}

.question-number {
    display: inline-block;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 15px;
}

.question-text {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2d3748;
    line-height: 1.5;
}

.question-description {
    color: #718096;
    margin-top: 10px;
    font-size: 0.95rem;
}

.required-mark {
    color: #e53e3e;
    font-weight: 700;
}

/* Form elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #4a5568;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* Radio and checkbox styles */
.radio-group, .checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.radio-option, .checkbox-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.radio-option:hover, .checkbox-option:hover {
    border-color: #667eea;
    background: #f7fafc;
}

.radio-option input, .checkbox-option input {
    width: 18px;
    height: 18px;
    accent-color: #667eea;
}

.radio-option label, .checkbox-option label {
    margin: 0;
    cursor: pointer;
    flex: 1;
}

/* Rating scale */
.rating-scale {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 15px;
}

.rating-option {
    flex: 1;
    text-align: center;
    padding: 15px 10px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.rating-option:hover {
    border-color: #667eea;
    background: #f7fafc;
}

.rating-option.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.rating-option input {
    display: none;
}

.rating-value {
    font-size: 1.5rem;
    font-weight: 700;
    display: block;
    margin-bottom: 5px;
}

.rating-label {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* Navigation buttons */
.survey-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding-top: 30px;
    border-top: 2px solid #e2e8f0;
}

.nav-btn, .submit-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
}

.prev-btn {
    background: #f7fafc;
    color: #718096;
    border: 2px solid #e2e8f0;
}

.prev-btn:hover {
    background: #edf2f7;
    color: #4a5568;
}

.next-btn, .submit-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.next-btn:hover, .submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Modal styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    animation: slideUp 0.4s ease-out;
}

.modal-header {
    margin-bottom: 20px;
}

.success-icon {
    font-size: 4rem;
    color: #48bb78;
    margin-bottom: 20px;
}

.modal-header h2 {
    font-size: 2rem;
    color: #2d3748;
    margin-bottom: 10px;
}

.modal-body {
    margin-bottom: 30px;
}

.modal-body p {
    color: #718096;
    font-size: 1.1rem;
    line-height: 1.6;
}

.modal-footer {
    display: flex;
    justify-content: center;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

/* Enhanced Success Modal Styles */
.success-details {
    margin: 20px 0;
    text-align: left;
}

.success-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border-left: 4px solid #28a745;
}

.success-info p {
    margin: 8px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #2d3748;
    font-size: 0.95rem;
}

.success-info i {
    color: #28a745;
    width: 20px;
    text-align: center;
}

.success-message {
    background: #e8f5e8;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border: 1px solid #28a745;
}

.success-message p {
    color: #155724;
    margin: 0;
    font-weight: 500;
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(108, 117, 125, 0.3);
}

/* Section header within questions */
.section-header-badge {
    display: inline-block;
    background: linear-gradient(135deg, #2d3748, #4a5568);
    color: white;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 12px;
}

/* Info / read-only question type */
.info-content {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 20px;
    line-height: 1.7;
    color: #4a5568;
    font-size: 0.95rem;
}

/* Grid / matrix table */
.grid-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.grid-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 400px;
    font-size: 0.9rem;
}

.grid-table thead th {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 10px 12px;
    text-align: center;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid rgba(255,255,255,0.15);
}

.grid-table thead th.row-header-cell {
    background: #2d3748;
    text-align: left;
    min-width: 180px;
}

.grid-table tbody td {
    padding: 6px 8px;
    border: 1px solid #e2e8f0;
    vertical-align: middle;
}

.grid-table tbody td.row-label {
    background: #f7fafc;
    font-weight: 500;
    color: #2d3748;
    padding: 10px 12px;
    white-space: normal;
    min-width: 220px;
    max-width: 350px;
}

.grid-table tbody tr:hover td {
    background-color: #f0f4ff;
}

.grid-table tbody tr:hover td.row-label {
    background-color: #edf2f7;
}

.grid-table input[type="number"],
.grid-table input[type="text"] {
    width: 100%;
    min-width: 70px;
    padding: 8px 10px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    text-align: center;
    transition: border-color 0.2s ease;
}

.grid-table input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.15);
}

.grid-table textarea {
    width: 100%;
    min-width: 120px;
    min-height: 60px;
    padding: 8px 10px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s ease;
}

.grid-table textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.15);
}

/* Fieldset — multiple labeled inputs on one screen */
.fieldset-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.fieldset-row {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 16px;
}

.fieldset-label {
    min-width: 200px;
    font-weight: 500;
    color: #2d3748;
    flex-shrink: 0;
}

.fieldset-label .required-mark {
    color: #e53e3e;
    font-weight: 700;
}

.fieldset-input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.fieldset-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.15);
}

/* OTP verification on surveyor details page */
.otp-verify-section {
    margin-top: 8px;
    padding: 16px;
    border: 2px dashed #c3dafe;
    border-radius: 12px;
    background: #f7faff;
}

.otp-notice {
    color: #4a5568;
    font-size: 0.92rem;
    margin-bottom: 14px;
    line-height: 1.5;
}

.otp-input {
    letter-spacing: 0.35em;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    max-width: 220px;
}

.otp-resend-btn {
    margin-top: 12px;
    background: none;
    border: none;
    color: #667eea;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}

.otp-resend-btn:hover {
    color: #5a67d8;
}

.verify-summary {
    color: #4a5568;
    font-size: 0.92rem;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: #f7fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

/* Grouped grid — column group headers */
.grid-table thead th.col-group-header {
    background: #2d3748;
    font-size: 0.85rem;
    letter-spacing: 0.3px;
    border-bottom: 2px solid rgba(255,255,255,0.3);
}

.grid-table thead th.col-sub-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    font-size: 0.8rem;
    padding: 8px 6px;
}

/* Section description text (below section badge) */
.section-description-text {
    color: #5a6a80;
    font-size: 0.9rem;
    font-style: italic;
    margin-bottom: 12px;
    padding: 10px 14px;
    background: #fefce8;
    border-left: 3px solid #eab308;
    border-radius: 0 6px 6px 0;
    line-height: 1.5;
}

/* Termination / screen-out screen */
.termination-screen {
    text-align: center;
    padding: 50px 30px;
}

.termination-icon {
    font-size: 3.5rem;
    color: #e53e3e;
    margin-bottom: 20px;
}

.termination-message {
    font-size: 1.05rem;
    color: #4a5568;
    max-width: 500px;
    margin: 0 auto;
}

/* Grid select dropdowns */
.grid-select {
    width: 100%;
    min-width: 90px;
    padding: 8px 10px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: inherit;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.grid-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.15);
}

/* "Other (specify)" text input for checkbox/radio */
.other-specify-input {
    margin-top: 8px;
    margin-left: 30px;
    width: calc(100% - 30px);
    padding: 10px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.other-specify-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.15);
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header-content h1 {
        font-size: 2rem;
    }
    
    .survey-selector, .survey-container {
        padding: 20px;
    }
    
    .survey-cards {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .survey-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .progress-container {
        justify-content: center;
    }
    
    .progress-bar {
        width: 150px;
    }
    
    .survey-navigation {
        flex-direction: column;
        gap: 15px;
    }
    
    .nav-btn, .submit-btn {
        width: 100%;
        justify-content: center;
    }
    
    .rating-scale {
        flex-wrap: wrap;
    }
    
    .rating-option {
        min-width: 60px;
    }

    .fieldset-row {
        flex-direction: column;
        align-items: stretch;
    }

    .fieldset-label {
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .question-container {
        padding: 20px;
    }
    
    .modal-content {
        padding: 30px 20px;
    }
    
    .success-icon {
        font-size: 3rem;
    }
    
    .modal-header h2 {
        font-size: 1.5rem;
    }
}
