:root{
    --primary: #181b20;
    --muted: #6b7280;
    --bg: #f4f6f8;
    --card: #ffffff;
    --radius: 10px;
}

*, *::before, *::after{
    box-sizing: border-box;
}

/* Splash Screen */
.splash-screen{
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary), #2c3039);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.splash-screen.fade-out{
    opacity: 0;
    visibility: hidden;
}

.splash-content{
    text-align: center;
    animation: splashFadeIn 0.6s ease-out;
}

@keyframes splashFadeIn{
    from{opacity: 0; transform: translateY(20px)}
    to{opacity: 1; transform: translateY(0)}
}

.splash-logo{
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    margin-bottom: 30px;
    animation: logoFloat 2s ease-in-out infinite;
}

@keyframes logoFloat{
    0%, 100%{transform: translateY(0)}
    50%{transform: translateY(-10px)}
}

.splash-spinner{
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid rgba(255,255,255,0.2);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.splash-text{
    color: #ffffff;
    font-size: 16px;
    font-weight: 500;
    margin: 0;
    opacity: 0.9;
}

/* Page layout */
body{
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, system-ui, -apple-system, sans-serif;
    margin: 0;
    background: linear-gradient(135deg, var(--primary), #2c3039);
    color: #111827;
    -webkit-font-smoothing:antialiased;
    -moz-osx-font-smoothing:grayscale;
}

.container{
    max-width: 920px;
    margin: 36px auto;
    padding: 20px;
}

/* Header */
.site-header{
    display:flex;
    align-items:center;
    gap:16px;
    margin-bottom:18px;
}

.site-logo{
    width:72px;
    height:72px;
    object-fit:cover;
    border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.1);
    box-shadow: 0 4px 14px rgba(0,0,0,0.3);
}

.site-title{
    font-size:20px;
    margin:0;
    color:#ffffff;
}

/* Card containing the form */
.form-card{
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    padding: 20px;
    display: block;
}

.section-title{
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    margin: 24px 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #e6e9ee;
}

.section-title:first-child{
    margin-top: 0;
}

.form-field{
    display:flex;
    flex-direction:column;
    gap:6px;
    margin-bottom: 16px;
}

label{
    font-size:13px;
    font-weight:600;
    color:var(--muted);
}

input[type="text"],
input[type="tel"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="time"],
textarea,
select{
    width:100%;
    padding:12px 14px;
    border-radius:8px;
    border:1px solid #e6e9ee;
    background: #fff;
    font-size:14px;
    transition: box-shadow .12s ease, border-color .12s ease;
}

textarea{min-height:110px;resize:vertical}

input:focus, textarea:focus, select:focus{
    outline: none;
    box-shadow: 0 4px 18px rgba(24,27,32,0.08);
    border-color: var(--primary);
}

.error{
    color:#dc2626;
    font-size:13px;
    font-weight:600;
    margin-top:6px;
    padding:8px 12px;
    background:#fef2f2;
    border-left:3px solid #dc2626;
    border-radius:4px;
}

.error:empty{
    display:none;
    padding:0;
    margin:0;
}

.form-field.has-error input,
.form-field.has-error textarea,
.form-field.has-error select{
    border-color:#dc2626;
    background:#fef2f2;
}

.success-message{
    background: linear-gradient(90deg, rgba(34,197,94,0.08), rgba(34,197,94,0.04));
    color: #166534;
    padding: 12px 14px;
    border-radius:8px;
    margin-bottom:8px;
}

#messages .error{
    background:#fef2f2;
    color:#dc2626;
    padding:14px 16px;
    border-radius:8px;
    margin-bottom:12px;
    border-left:4px solid #dc2626;
    font-weight:600;
    display:flex;
    align-items:center;
    gap:8px;
}

.form-actions{
    display:flex;
    justify-content:flex-end;
    margin-top:8px;
    padding:20px;
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}

button{
    padding:10px 18px;
    border-radius:8px;
    border: none;
    cursor: pointer;
    font-weight:600;
    transition: transform .08s ease, box-shadow .08s ease, opacity .08s ease;
}

button.primary{
    background: #ffffff;
    color: var(--primary);
    box-shadow: 0 6px 18px rgba(0,0,0,0.3);
    position:relative;
}

button.primary:hover:not(:disabled){
    transform:translateY(-1px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
button:disabled{opacity:.7;cursor:not-allowed;transform:none}

button.loading{
    pointer-events:none;
}

button.loading::after{
    content:"";
    position:absolute;
    width:16px;
    height:16px;
    top:50%;
    left:50%;
    margin-left:-8px;
    margin-top:-8px;
    border:2px solid var(--primary);
    border-radius:50%;
    border-top-color:transparent;
    animation:spin 0.6s linear infinite;
}

@keyframes spin{
    to{transform:rotate(360deg)}
}

/* Radio & Checkbox Custom Styling */
.form-field > div{
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-field > div > label{
    display: flex;
    align-items: center;
    padding: 12px 14px;
    background: #fff;
    border: 2px solid #e6e9ee;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.form-field > div > label:hover{
    border-color: var(--primary);
    background: #f9fafb;
}

/* Hide default radio/checkbox */
.form-field input[type="radio"],
.form-field input[type="checkbox"]{
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

/* Custom radio button */
.form-field input[type="radio"] + span::before{
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    border-radius: 50%;
    margin-right: 10px;
    transition: all 0.2s ease;
    flex-shrink: 0;
    vertical-align: middle;
}

.form-field input[type="radio"]:checked + span::before{
    border-color: var(--primary);
    background: var(--primary);
    box-shadow: inset 0 0 0 4px #fff;
}

/* Custom checkbox */
.form-field input[type="checkbox"] + span::before{
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    margin-right: 10px;
    transition: all 0.2s ease;
    flex-shrink: 0;
    vertical-align: middle;
}

.form-field input[type="checkbox"]:checked + span::before{
    border-color: var(--primary);
    background: var(--primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M3 8l3 3 7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 14px;
}

/* Selected state for span text */
.form-field input[type="radio"]:checked + span,
.form-field input[type="checkbox"]:checked + span{
    font-weight: 600;
}

.form-field label:has(input[type="radio"]:checked),
.form-field label:has(input[type="checkbox"]:checked){
    border-color: var(--primary);
    background: rgba(24, 27, 32, 0.04);
}

/* File Input Custom Styling */
input[type="file"]{
    padding: 0;
    border: 2px dashed #e6e9ee;
    background: #f9fafb;
    cursor: pointer;
    position: relative;
}

input[type="file"]::file-selector-button{
    padding: 10px 16px;
    margin-right: 14px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s ease;
}

input[type="file"]::file-selector-button:hover{
    background: #0f1115;
}

input[type="file"]:hover{
    border-color: var(--primary);
    background: #fff;
}

/* Range Slider Enhanced Styling */
input[type="range"]{
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: #e6e9ee;
    border-radius: 4px;
    outline: none;
    padding: 0;
    margin: 10px 0;
    transition: background 0.1s ease;
}

/* Webkit browsers (Chrome, Safari, Edge) */
input[type="range"]::-webkit-slider-thumb{
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: var(--primary);
    border: 3px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(24,27,32,0.2);
    transition: all 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover{
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(24,27,32,0.3);
}

input[type="range"]::-webkit-slider-thumb:active{
    transform: scale(1.05);
}

/* Firefox */
input[type="range"]::-moz-range-thumb{
    width: 24px;
    height: 24px;
    background: var(--primary);
    border: 3px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(24,27,32,0.2);
    transition: all 0.2s ease;
}

input[type="range"]::-moz-range-thumb:hover{
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(24,27,32,0.3);
}

input[type="range"]::-moz-range-thumb:active{
    transform: scale(1.05);
}

input[type="range"]::-moz-range-track{
    background: transparent;
}

/* Range value display */
input[type="range"]:focus{
    outline: none;
}

/* Radio / checkbox inline labels - now removed as we have better styling above */

/* Utilities */
.hidden{display:none}

/* Success Page */
.success-page{
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    padding: 60px 40px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.success-icon{
    animation: successPop 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes successPop{
    0%{transform: scale(0); opacity: 0}
    50%{transform: scale(1.1)}
    100%{transform: scale(1); opacity: 1}
}

.success-title{
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}

.success-page .success-message{
    font-size: 18px;
    font-weight: 600;
    color: #22c55e;
    margin: 0;
    background: none;
    padding: 0;
    border-radius: 0;
}

.success-description{
    font-size: 15px;
    color: var(--muted);
    max-width: 500px;
    line-height: 1.6;
    margin: 0;
}

.success-page button{
    margin-top: 12px;
    font-size: 15px;
}

@media (max-width:640px){
    .success-page{
        padding: 40px 20px;
    }
    .success-icon svg{
        width: 60px;
        height: 60px;
    }
    .success-title{
        font-size: 24px;
    }
}

@media (max-width:640px){
    .container{padding:12px}
    .site-logo{width:56px;height:56px}
    .site-title{font-size:18px}
    .form-actions{justify-content:stretch}
    button{width:100%}
}
