:root {
    --bg-color: #050505; /* Deep dark tech background */
    --card-bg: rgba(10, 15, 25, 0.7); /* Deep glass effect */
    --text-main: #f8fafc;
    --text-muted: #8b9eb3;
    --primary: #00f3ff; /* Neon Cyan */
    --primary-hover: #00c2cc;
    --border-color: rgba(0, 243, 255, 0.2);
    --danger: #ff0055;
    --success: #00ff88;
    --input-bg: rgba(5, 10, 15, 0.8);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 2rem;
    position: relative;
    overflow-x: hidden;
}

/* Particles JS Background */
#particles-js {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-color);
    z-index: -1;
}



.container {
    margin: auto;
    width: 100%;
    max-width: 900px;
    background: var(--card-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-color);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    border-left: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 3rem;
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    position: relative;
    z-index: 10;
}

.app-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.app-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.app-header p {
    color: var(--text-muted);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

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

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.95rem;
}

.hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: normal;
}

.required {
    color: var(--danger);
    margin-left: 0.2rem;
}

input[type="text"], select {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

input[type="text"]:focus, select:focus {
    outline: none;
    background-color: rgba(15, 23, 42, 0.8);
    border-color: rgba(99, 102, 241, 0.5);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15), inset 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

/* Fix browser autofill styling */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px #0f172a inset !important;
    -webkit-text-fill-color: var(--text-main) !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* Fix dropdown options readability in dark mode */
select option {
    background-color: #1e293b; /* Slate 800 - solid dark background */
    color: var(--text-main);
    padding: 0.5rem;
}

select option:disabled {
    color: var(--text-muted);
}

/* Quill Editor Styling */
.ql-toolbar.ql-snow, .ql-container.ql-snow {
    border-color: var(--border-color);
    border-radius: 8px 8px 0 0;
    background: var(--input-bg);
}
.ql-container.ql-snow {
    border-radius: 0 0 8px 8px;
    border-top: none;
    min-height: 200px;
    font-family: inherit;
    font-size: 1rem;
    color: var(--text-main);
}
.ql-toolbar.ql-snow {
    background: rgba(30, 41, 59, 0.9);
}
.ql-snow .ql-stroke { stroke: var(--text-muted); }
.ql-snow .ql-fill { fill: var(--text-muted); }
.ql-snow .ql-picker { color: var(--text-muted); }

/* Fix Quill placeholder visibility */
.ql-editor.ql-blank::before {
    color: rgba(255, 255, 255, 0.4) !important;
    font-style: italic;
}

.signature-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.signature-section h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.signature-preview {
    background: #ffffff; /* White background for email realism */
    padding: 1.5rem;
    border-radius: 8px;
    color: #333333;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2.5rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    color: white;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
    position: relative;
    overflow: hidden;
}

.btn-primary::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.2), transparent);
    transform: skewX(-20deg);
    transition: all 0.5s;
}

.btn-primary:hover::after {
    left: 150%;
    transition: all 0.7s cubic-bezier(0.19, 1, 0.22, 1);
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.6);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    margin-left: 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.btn.loading .btn-text {
    opacity: 0.8;
}

.btn.loading .spinner {
    display: block;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.message-box {
    margin-top: 1.5rem;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    display: none;
    text-align: center;
    font-weight: 600;
    backdrop-filter: blur(12px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.5px;
}

.message-box.success {
    display: block;
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(52, 211, 153, 0.4);
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.message-box.error {
    display: block;
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(248, 113, 113, 0.4);
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    color: #333;
    width: 100%;
    max-width: 800px;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.25rem;
    margin: 0;
}

.close-btn {
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    color: #666;
}

.close-btn:hover {
    color: #000;
}

.modal-body {
    padding: 2rem;
    line-height: 1.6;
}

@media (max-width: 768px) {
    body {
        padding: 1rem;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .container {
        padding: 1.5rem;
    }
    .app-header h1 {
        font-size: 2rem;
    }
    .form-actions {
        flex-direction: column-reverse;
        gap: 0.75rem;
    }
    .btn {
        width: 100%;
    }
    .pin-container {
        padding: 2rem 1rem;
        width: 90%;
        max-width: 350px;
    }
    .pin-box {
        width: 45px;
        height: 55px;
        font-size: 1.5rem;
    }
}

@media (max-width: 400px) {
    .pin-box {
        width: 40px;
        height: 50px;
    }
    .pin-boxes {
        gap: 0.5rem;
    }
}

/* PIN Overlay - Liquid Glass Animation */
.pin-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.pin-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.pin-container {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 3rem;
    border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
    animation: liquidMorph 8s ease-in-out infinite alternate;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.pin-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.2) 0%, transparent 60%);
    animation: rotate 10s linear infinite;
    z-index: -1;
}

@keyframes liquidMorph {
    0% { border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%; }
    34% { border-radius: 70% 30% 50% 50% / 30% 30% 70% 70%; }
    67% { border-radius: 100% 60% 60% 100% / 100% 100% 60% 60%; }
    100% { border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%; }
}

@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.pin-container h2 {
    margin-bottom: 2rem;
    font-weight: 600;
    letter-spacing: 1px;
}

.pin-boxes {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.pin-box {
    width: 50px;
    height: 60px;
    font-size: 2rem;
    text-align: center;
    background: rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: white;
    transition: all 0.3s ease;
}

.pin-box:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
    background: rgba(0, 0, 0, 0.4);
}

.pin-error {
    color: #ef4444;
    margin-top: 1rem;
    font-size: 0.9rem;
    height: 20px;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}
.error-shake {
    animation: shake 0.3s ease-in-out;
    border-color: #ef4444 !important;
}

/* Staggered Entry Animations */
.animate-slide-up {
    opacity: 0;
    transform: translateY(30px);
    animation: slideUpFade 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }
.delay-6 { animation-delay: 0.6s; }
