/* Reset & Base Setup */
@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400..700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    --bg-base: #030305;
    --card-bg: rgba(18, 18, 24, 0.55);
    --card-border: rgba(255, 255, 255, 0.08);
    --text-main: #f3f3f4;
    --text-muted: #8a8a93;
    --accent: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.4);
    --accent-hover: #818cf8;
    --input-bg: rgba(255, 255, 255, 0.03);
    --input-border: rgba(255, 255, 255, 0.06);
    --success: #10b981;
    --error: #f43f5e;
    
    font-family: 'Bricolage Grotesque', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

/* Animated Background setup */
body::before, body::after {
    content: '';
    position: absolute;
    width: 60vw;
    height: 60vw;
    border-radius: 50%;
    filter: blur(120px);
    z-index: -1;
    animation: float 20s infinite alternate ease-in-out;
    opacity: 0.12;
}

body::before {
    background: radial-gradient(circle, #4f46e5, transparent 60%);
    top: -20vh;
    left: -10vw;
}

body::after {
    background: radial-gradient(circle, #ec4899, transparent 60%);
    bottom: -20vh;
    right: -10vw;
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(10vw, 5vh) scale(1.1); }
}

/* Global grain overlay */
.grain-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* App Container & Staggered Entrance */
.app-container {
    width: 100%;
    max-width: 480px;
    padding: 24px;
    z-index: 10;
    perspective: 1000px;
}

.header {
    text-align: center;
    margin-bottom: 36px;
    animation: slideDown 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
    transform: translateY(-20px);
}

.title-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}

.icon { 
    font-size: 32px; 
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.6)); 
}

h1 {
    font-size: 34px;
    font-weight: 700;
    letter-spacing: -0.04em;
    background: linear-gradient(135deg, #ffffff 0%, #a1a1aa 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--text-muted);
    letter-spacing: -0.02em;
}

/* Form Panel */
.glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(30px) saturate(150%);
    -webkit-backdrop-filter: blur(30px) saturate(150%);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 36px 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    
    opacity: 0;
    transform: translateY(30px) rotateX(10deg);
    animation: panelEnter 1s cubic-bezier(0.16, 1, 0.3, 1) 0.1s forwards;
}

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

@keyframes panelEnter {
    to { opacity: 1; transform: translateY(0) rotateX(0deg); }
}

/* Form Groups */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    opacity: 0;
    transform: translateX(-15px);
    animation: slideRight 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.form-group:nth-child(1) { animation-delay: 0.3s; }
.form-group:nth-child(2) { animation-delay: 0.4s; }
.form-group:nth-child(3) { animation-delay: 0.5s; }
.form-group:nth-child(4) { animation-delay: 0.6s; }

@keyframes slideRight {
    to { opacity: 1; transform: translateX(0); }
}

.row-group {
    display: flex;
    gap: 20px;
}

.half-width { flex: 1; }
.flex-col { flex-direction: column; }

label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 4px;
}

/* Inputs */
.input-wrapper, .select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

input[type="text"], input[type="url"], select, textarea {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-main);
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    padding: 14px 16px;
    border-radius: 12px;
    outline: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    appearance: none;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

select { cursor: pointer; padding-right: 40px; }

input:focus, select:focus, textarea:focus {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow), inset 0 0 0 1px var(--accent);
}

input::placeholder, textarea::placeholder {
    color: rgba(255, 255, 255, 0.2);
    font-family: 'Bricolage Grotesque', sans-serif;
}

textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.6;
}

/* Custom Dropdown Arrow */
.dropdown-icon {
    position: absolute;
    right: 14px;
    pointer-events: none;
    color: var(--text-muted);
    transition: color 0.3s ease;
}

select:focus + .dropdown-icon {
    color: var(--accent);
}

/* Clear Button */
.btn-clear {
    position: absolute;
    right: 12px;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--text-main);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-clear:hover { 
    background: rgba(255, 255, 255, 0.15); 
    color: #fff;
    transform: scale(1.1); 
}
.btn-clear svg {
    width: 14px;
    height: 14px;
}
input:not(:placeholder-shown) + .btn-clear { display: flex; }

/* Star Rating */
.align-center { align-items: center; }

.star-rating {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: 4px;
}

.star-rating input { display: none; }

.star-rating label {
    font-size: 24px;
    color: rgba(255, 255, 255, 0.08);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    margin: 0;
    text-shadow: 0 0 0 transparent;
}

/* Fix ordering selection */
.star-rating label:hover,
.star-rating label:hover ~ label,
.star-rating input:checked ~ label {
    color: #fbbf24;
    text-shadow: 0 0 16px rgba(251, 191, 36, 0.4);
    transform: scale(1.15) translateY(-2px);
}

.star-rating label:active { transform: scale(0.9); }

/* Submit Button */
.submit-btn {
    position: relative;
    background: linear-gradient(135deg, var(--accent), #4f46e5);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 14px;
    font-size: 16px;
    font-family: 'Bricolage Grotesque', sans-serif;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    margin-top: 12px;
    box-shadow: 0 8px 24px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.2);
    
    opacity: 0;
    transform: translateY(20px);
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.8s forwards;
}

.submit-btn::before {
    content: '';
    position: absolute;
    top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    transition: left 0.6s ease;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.3);
}

.submit-btn:hover::before { left: 100%; }
.submit-btn:active { transform: translateY(1px); box-shadow: 0 4px 12px var(--accent-glow); }

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

/* Overlays & Status */
.status-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(3, 3, 5, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.status-overlay.active { opacity: 1; pointer-events: all; }

.status-overlay h2 {
    font-size: 28px; margin-top: 24px; margin-bottom: 8px; color: var(--text-main); font-weight: 700;
}

.status-overlay p { color: var(--text-muted); font-size: 15px; font-family: 'JetBrains Mono', monospace; }

/* SVG Spinner */
.spinner { width: 24px; height: 24px; animation: rotate 2s linear infinite; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.spinner .path { stroke: white; stroke-linecap: round; animation: dash 1.5s ease-in-out infinite; }
@keyframes rotate { 100% { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes dash { 
    0% { stroke-dasharray: 1, 150; stroke-dashoffset: 0; }
    50% { stroke-dasharray: 90, 150; stroke-dashoffset: -35; }
    100% { stroke-dasharray: 90, 150; stroke-dashoffset: -124; }
}

/* Modern Checkmark */
.checkmark { width: 72px; height: 72px; border-radius: 50%; stroke-width: 2.5; stroke: var(--success); stroke-miterlimit: 10; box-shadow: inset 0 0 0 var(--success); animation: fill .4s ease-in-out .4s forwards, scale .3s ease-in-out .9s both; }
.checkmark__circle { stroke-dasharray: 166; stroke-dashoffset: 166; stroke-width: 2.5; stroke-miterlimit: 10; stroke: var(--success); fill: none; animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards; }
.checkmark__check { transform-origin: 50% 50%; stroke-dasharray: 48; stroke-dashoffset: 48; animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards; }
@keyframes fill { 100% { box-shadow: inset 0px 0px 0px 36px var(--success); } }

.cross-animation { font-size: 56px; color: var(--error); margin-bottom: 20px; animation: scale 0.3s ease-in-out both; }
.btn-secondary { background: rgba(255, 255, 255, 0.05); color: white; border: 1px solid rgba(255, 255, 255, 0.1); padding: 12px 24px; border-radius: 12px; font-size: 14px; cursor: pointer; margin-top: 24px; transition: all 0.2s; font-family: 'JetBrains Mono', monospace; }
.btn-secondary:hover { background: rgba(255, 255, 255, 0.1); }
