:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #6366f1;
    --primary-bg: #eef2ff;
    --secondary: #0f172a;
    --success: #10b981;
    --success-bg: #d1fae5;
    --error: #ef4444;
    --error-bg: #fee2e2;
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --star-empty: #d1d5db;
    --star-filled: #fbbf24;
    --star-hover: #f59e0b;
    --font-family: 'Inter', -apple-system, sans-serif;
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 20px rgba(79, 70, 229, 0.3);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #6366f1 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--gray-800);
    line-height: 1.6;
    padding: 1.5rem;
}

/* Main Container */
.form-container {
    max-width: 800px;
    margin: 0 auto;
    background: var(--white);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl), 0 0 60px rgba(79, 70, 229, 0.15);
    overflow: hidden;
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Brand Header */
.brand-header {
    background: linear-gradient(135deg, var(--white) 0%, var(--primary-bg) 100%);
    padding: 1.5rem 2rem;
    text-align: center;
    border-bottom: 1px solid var(--gray-100);
}

.logo-link {
    display: inline-block;
    transition: transform 0.2s;
}

.logo-link:hover {
    transform: scale(1.02);
}

.brand-logo {
    max-height: 60px;
    width: auto;
}

.tagline {
    color: var(--gray-500);
    font-size: 0.875rem;
    font-style: italic;
    margin-top: 0.5rem;
    letter-spacing: 0.025em;
}

/* Progress Container */
.progress-container {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 1.5rem 2rem;
}

.step-indicator {
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1rem;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 9999px;
    overflow: hidden;
    margin-bottom: 1.25rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #fff 0%, #e0e7ff 100%);
    border-radius: 9999px;
    width: 14.28%;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.progress-steps {
    display: flex;
    justify-content: space-between;
}

.step {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    cursor: default;
}

.step-content {
    display: flex;
    align-items: center;
    justify-content: center;
}

.step.active {
    background: var(--white);
    color: var(--primary);
    transform: scale(1.15);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.3);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.1);
    }
}

.step.completed {
    background: var(--success);
    color: var(--white);
}

.step.completed .step-content::before {
    content: '✓';
    font-weight: bold;
}

.step.completed .step-content {
    font-size: 0;
}

.step.completed .step-content::before {
    font-size: 0.875rem;
}

/* Form Title */
.form-title {
    text-align: center;
    padding: 2rem 2rem 1rem;
    background: linear-gradient(to bottom, var(--primary-bg) 0%, var(--white) 100%);
}

.form-title h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 0.25rem;
}

.form-title .subtitle {
    color: var(--gray-500);
    font-size: 1rem;
}

/* Form Sections */
.form-section {
    display: none;
    padding: 2rem;
    animation: slideIn 0.4s ease-out;
}

.form-section.active {
    display: block;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Section Header with Icons */
.section-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    background: linear-gradient(135deg, var(--primary-bg) 0%, rgba(238, 242, 255, 0.5) 100%);
    border-radius: var(--radius-lg);
    border-left: 4px solid var(--primary);
}

.section-icon {
    font-size: 2rem;
    line-height: 1;
    flex-shrink: 0;
}

.section-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--secondary);
    margin: 0;
}

.section-subtitle {
    color: var(--gray-500);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.section-description {
    color: var(--gray-500);
    font-size: 0.9375rem;
    margin-bottom: 1.5rem;
    padding-left: 0.5rem;
}

/* Form Groups */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
    font-size: 0.9375rem;
    transition: color 0.2s;
}

.required {
    color: var(--error);
}

/* Input Fields */
input[type="text"],
input[type="date"],
textarea,
select {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    color: var(--gray-800);
    background: var(--white);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-bg), var(--shadow-md);
    transform: translateY(-1px);
}

input::placeholder,
textarea::placeholder {
    color: var(--gray-400);
}

input.error,
select.error {
    border-color: var(--error);
    background: var(--error-bg);
}

.error-message {
    display: block;
    color: var(--error);
    font-size: 0.8125rem;
    margin-top: 0.25rem;
    min-height: 1.25rem;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* Custom Select */
select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
    cursor: pointer;
}

select:hover {
    border-color: var(--gray-300);
}

/* Instructions Box */
.instructions-box {
    display: flex;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #fef3c7 0%, #fef9c3 100%);
    border-radius: var(--radius-md);
    border-left: 4px solid #f59e0b;
    margin: 1.5rem 0;
}

.instructions-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    color: #d97706;
}

.instructions-icon svg {
    width: 100%;
    height: 100%;
}

.instructions-box p {
    color: var(--gray-700);
    font-size: 0.9375rem;
}

/* Rating Groups */
.rating-group {
    margin-bottom: 1rem;
    padding: 1rem 1.25rem;
    background: var(--gray-50);
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-100);
    transition: all 0.2s;
}

.rating-group:hover {
    background: var(--white);
    border-color: var(--primary-light);
    box-shadow: var(--shadow-sm);
}

.rating-group label {
    display: block;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.75rem;
    font-size: 0.9375rem;
}

/* Star Rating */
.star-rating {
    display: inline-flex;
    gap: 0.375rem;
}

.star {
    font-size: 2rem;
    color: var(--star-empty);
    cursor: pointer;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0 2px;
}

.star:hover,
.star.hover {
    color: var(--star-hover);
    transform: scale(1.25) rotate(-5deg);
    filter: drop-shadow(0 2px 4px rgba(245, 158, 11, 0.4));
}

.star.selected {
    color: var(--star-filled);
    animation: starPop 0.3s ease-out;
}

@keyframes starPop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }

    100% {
        transform: scale(1);
    }
}

.rating-label {
    display: inline-block;
    margin-left: 1rem;
    padding: 0.375rem 0.75rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 500;
    opacity: 0;
    transition: all 0.2s;
    transform: translateX(-10px);
}

.rating-label.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Radio Options */
.radio-group {
    margin-bottom: 1.5rem;
}

.radio-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.radio-options.horizontal {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 1rem;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--gray-50);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
}

.radio-option:hover {
    background: var(--primary-bg);
    border-color: var(--primary-light);
    transform: translateX(4px);
}

.radio-option input[type="radio"] {
    display: none;
}

.radio-custom {
    width: 22px;
    height: 22px;
    border: 2px solid var(--gray-300);
    border-radius: 50%;
    position: relative;
    transition: all 0.2s;
    flex-shrink: 0;
}

.radio-option input[type="radio"]:checked+.radio-custom {
    border-color: var(--primary);
    background: var(--primary);
    animation: radioCheck 0.3s ease-out;
}

@keyframes radioCheck {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

.radio-option input[type="radio"]:checked+.radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: var(--white);
    border-radius: 50%;
}

.radio-option input[type="radio"]:checked~.radio-label {
    color: var(--primary);
    font-weight: 600;
}

.radio-label {
    color: var(--gray-700);
    font-size: 0.9375rem;
}

/* Rating Cards */
.rating-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 1rem;
}

.rating-card {
    cursor: pointer;
}

.rating-card input[type="radio"] {
    display: none;
}

.card-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.5rem 1rem;
    background: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.rating-card:hover .card-content {
    border-color: var(--primary-light);
    background: var(--primary-bg);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.rating-card input[type="radio"]:checked+.card-content {
    border-color: var(--primary);
    background: var(--primary-bg);
    box-shadow: 0 0 0 4px var(--primary-bg), var(--shadow-lg);
    transform: translateY(-4px);
}

.card-emoji {
    font-size: 2.5rem;
    transition: transform 0.2s;
}

.rating-card:hover .card-emoji {
    transform: scale(1.15);
}

.card-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    text-align: center;
}

.rating-card input[type="radio"]:checked+.card-content .card-label {
    color: var(--primary);
}

/* Signature */
.signature-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

#signatureCanvas {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-md);
    background: var(--gray-50);
    cursor: crosshair;
    max-width: 100%;
    touch-action: none;
    transition: border-color 0.2s;
}

#signatureCanvas:hover {
    border-color: var(--primary);
}

.btn-clear-signature {
    align-self: flex-start;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    background: var(--gray-100);
    color: var(--gray-600);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-clear-signature:hover {
    background: var(--gray-200);
}

/* Navigation Buttons */
.nav-buttons {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-200);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
}

.btn-prev {
    background: var(--gray-100);
    color: var(--gray-700);
}

.btn-prev:hover {
    background: var(--gray-200);
    transform: translateX(-2px);
}

.btn-next {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    margin-left: auto;
}

.btn-next:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.btn-submit {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: var(--white);
    flex: 1;
    padding: 1rem 2rem;
    font-size: 1.0625rem;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 20px rgba(16, 185, 129, 0.4);
}

.btn-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.arrow {
    font-size: 1.25rem;
    transition: transform 0.2s;
}

.btn:hover .arrow {
    transform: translateX(3px);
}

.btn-prev:hover .arrow {
    transform: translateX(-3px);
}

/* Spinner */
.spinner {
    width: 20px;
    height: 20px;
    animation: rotate 1.5s linear infinite;
}

@keyframes rotate {
    100% {
        transform: rotate(360deg);
    }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-2xl);
    padding: 2.5rem 2rem;
    text-align: center;
    max-width: 440px;
    width: 100%;
    animation: modalIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: var(--shadow-xl);
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-brand {
    margin-bottom: 1rem;
}

.modal-logo {
    max-height: 50px;
    width: auto;
}

.modal-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: iconBounce 0.6s ease-out;
}

@keyframes iconBounce {
    0% {
        transform: scale(0);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

.modal-icon.success {
    background: var(--success-bg);
    color: var(--success);
}

.modal-icon svg {
    width: 44px;
    height: 44px;
}

.modal-content h2 {
    font-size: 1.5rem;
    color: var(--secondary);
    margin-bottom: 0.5rem;
}

.modal-content p {
    color: var(--gray-600);
    margin-bottom: 0.25rem;
}

.modal-subtitle {
    font-size: 0.875rem;
    color: var(--gray-400) !important;
    margin-bottom: 1.5rem !important;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    padding: 0.875rem 2rem;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md), var(--shadow-glow);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-600);
    padding: 0.75rem 1.5rem;
}

.btn-secondary:hover {
    background: var(--gray-200);
}

/* Responsive */
@media (max-width: 640px) {
    body {
        padding: 0.5rem;
    }

    .form-container {
        border-radius: var(--radius-xl);
    }

    .brand-header {
        padding: 1rem;
    }

    .brand-logo {
        max-height: 50px;
    }

    .progress-container {
        padding: 1rem;
    }

    .step {
        width: 32px;
        height: 32px;
        font-size: 0.75rem;
    }

    .step-indicator {
        font-size: 0.75rem;
    }

    .form-title {
        padding: 1.5rem 1rem 1rem;
    }

    .form-title h1 {
        font-size: 1.375rem;
    }

    .form-section {
        padding: 1.5rem 1rem;
    }

    .section-header {
        padding: 1rem;
    }

    .section-header h2 {
        font-size: 1.125rem;
    }

    .section-icon {
        font-size: 1.5rem;
    }

    .star {
        font-size: 1.75rem;
    }

    .rating-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .card-content {
        padding: 1rem 0.5rem;
    }

    .card-emoji {
        font-size: 1.75rem;
    }

    .nav-buttons {
        flex-wrap: wrap;
    }

    .btn {
        padding: 0.75rem 1rem;
        font-size: 0.9375rem;
    }

    .btn-submit {
        order: -1;
        width: 100%;
        margin-bottom: 0.5rem;
    }

    #signatureCanvas {
        height: 120px;
    }

    .modal-content {
        padding: 1.5rem;
    }

    .modal-actions {
        flex-direction: column;
    }
}

@media (max-width: 400px) {
    .rating-cards {
        grid-template-columns: 1fr;
    }

    .radio-options.horizontal {
        flex-direction: column;
    }
}