/* CSS Variable Definitions */
:root {
    --bg-dark: #080710;
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    /* Vibrant gradients and accent colors */
    --accent-purple: #8b5cf6;
    --accent-indigo: #6366f1;
    --accent-cyan: #06b6d4;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    
    --primary-gradient: linear-gradient(135deg, var(--accent-indigo) 0%, var(--accent-cyan) 100%);
    --hover-gradient: linear-gradient(135deg, #4f46e5 0%, #0891b2 100%);
    --success-gradient: linear-gradient(135deg, #059669 0%, #10b981 100%);
    --error-gradient: linear-gradient(135deg, #dc2626 0%, #f87171 100%);
    
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset and Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: 'Outfit', 'Noto Sans TC', sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
    padding: 2rem 1rem;
}

/* Background glowing circles */
.background-decorations {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.25;
}

.circle-1 {
    width: 400px;
    height: 400px;
    background: var(--accent-purple);
    top: -10%;
    left: -10%;
    animation: float-slow 15s infinite alternate;
}

.circle-2 {
    width: 500px;
    height: 500px;
    background: var(--accent-cyan);
    bottom: -15%;
    right: -10%;
    animation: float-slow 20s infinite alternate-reverse;
}

.circle-3 {
    width: 300px;
    height: 300px;
    background: var(--accent-indigo);
    top: 40%;
    left: 70%;
    animation: float-medium 12s infinite alternate;
}

@keyframes float-slow {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(40px, 40px) scale(1.1); }
}

@keyframes float-medium {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-30px, 50px) scale(0.95); }
}

/* Container */
.container {
    width: 100%;
    max-width: 680px;
    z-index: 10;
}

/* Header Section */
.header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo-area {
    width: 70px;
    height: 70px;
    background: var(--primary-gradient);
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 1.2rem;
    box-shadow: 0 8px 24px rgba(6, 182, 212, 0.3);
}

.logo-icon {
    font-size: 2rem;
    color: #ffffff;
    animation: pulse-glow 2s infinite ease-in-out;
}

@keyframes pulse-glow {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 2px rgba(255,255,255,0.6)); }
    50% { transform: scale(1.1); filter: drop-shadow(0 0 10px rgba(255,255,255,0.8)); }
}

.header h1 {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: 1px;
    background: linear-gradient(135deg, #ffffff 30%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--accent-cyan);
    font-weight: 600;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Form Card */
.form-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 2.5rem;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* Input groups */
.input-group {
    margin-bottom: 1.5rem;
    position: relative;
    display: flex;
    flex-direction: column;
}

.input-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.input-group label .icon {
    color: var(--accent-cyan);
    font-size: 1rem;
}

/* Inputs, Select and Textarea fields */
input[type="text"],
input[type="email"],
input[type="number"],
select,
textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 0.85rem 1rem;
    font-family: inherit;
    font-size: 0.95rem;
    color: #ffffff;
    transition: var(--transition-normal);
    outline: none;
}

input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="number"]::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

/* Input Focus Styles */
input[type="text"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent-indigo);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25), 0 0 15px rgba(99, 102, 241, 0.15);
}

/* Error States */
.input-group.invalid input,
.input-group.invalid select,
.input-group.invalid textarea {
    border-color: rgba(239, 68, 68, 0.5);
    background: rgba(239, 68, 68, 0.03);
}

.input-group.invalid input:focus,
.input-group.invalid select:focus,
.input-group.invalid textarea:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25);
    border-color: var(--accent-red);
}

.error-msg {
    color: #fca5a5;
    font-size: 0.8rem;
    margin-top: 0.4rem;
    display: none;
    align-items: center;
    gap: 0.3rem;
}

.input-group.invalid .error-msg {
    display: flex;
    animation: fadeIn 0.2s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Custom Dropdown select wrapper */
.select-wrapper {
    position: relative;
    width: 100%;
}

.select-wrapper::after {
    content: "\f078";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 0.8rem;
    color: var(--text-secondary);
    position: absolute;
    right: 1.1rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    transition: var(--transition-fast);
}

select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 2.5rem;
    cursor: pointer;
}

select option {
    background: #111827;
    color: #ffffff;
}

select:focus-within + .select-wrapper::after {
    transform: translateY(-50%) rotate(180deg);
    color: var(--accent-cyan);
}

/* Custom Radio Buttons */
.radio-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
    margin-top: 0.2rem;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition-normal);
    user-select: none;
}

.radio-label input[type="radio"] {
    display: none;
}

.radio-custom {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: inline-block;
    position: relative;
    transition: var(--transition-fast);
}

.radio-custom::after {
    content: "";
    width: 8px;
    height: 8px;
    background: var(--accent-cyan);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    transition: var(--transition-fast);
}

.radio-label:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
}

.radio-label:has(input[type="radio"]:checked) {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--accent-indigo);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.1);
}

.radio-label input[type="radio"]:checked + .radio-custom {
    border-color: var(--accent-cyan);
}

.radio-label input[type="radio"]:checked + .radio-custom::after {
    transform: translate(-50%, -50%) scale(1);
}

/* Flex Grid layouts */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.2rem;
}

/* Textarea extra styles */
textarea {
    resize: vertical;
    min-height: 90px;
}

/* Submit Button */
.submit-btn {
    width: 100%;
    background: var(--primary-gradient);
    border: none;
    border-radius: 14px;
    padding: 1rem;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.6rem;
    margin-top: 1.8rem;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

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

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(6, 182, 212, 0.4);
    background: var(--hover-gradient);
}

.submit-btn:hover::before {
    left: 100%;
}

.submit-btn:active {
    transform: translateY(1px);
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

/* Loading spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

.spinner.hidden {
    display: none;
}

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

.hidden {
    display: none !important;
}

/* Modal Overlay Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: rgba(17, 24, 39, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 2.5rem;
    width: 90%;
    max-width: 480px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-card {
    transform: scale(1);
}

.modal-icon-wrapper {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 1.2rem;
    font-size: 1.8rem;
    color: #ffffff;
    background: var(--primary-gradient);
}

.modal-icon-wrapper.success {
    background: var(--success-gradient);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

.modal-icon-wrapper.error {
    background: var(--error-gradient);
    box-shadow: 0 0 20px rgba(239, 68, 110, 0.4);
}

.modal-icon-wrapper.info {
    background: var(--primary-gradient);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
}

.modal-card h2 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0.8rem;
}

.modal-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

/* Modal details preview container */
.modal-details {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    text-align: left;
    font-size: 0.85rem;
    max-height: 150px;
    overflow-y: auto;
}

.modal-details-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.4rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
}

.modal-details-row:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.modal-details-label {
    color: var(--text-muted);
}

.modal-details-val {
    color: var(--text-primary);
    font-weight: 600;
}

/* Modal action button */
.modal-btn {
    width: 100%;
    padding: 0.85rem;
    border: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
}

.modal-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.modal-btn.success {
    background: var(--accent-green);
}
.modal-btn.success:hover {
    background: #059669;
}

.modal-btn.error {
    background: var(--accent-red);
}
.modal-btn.error:hover {
    background: #dc2626;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    body {
        padding: 1rem 0.5rem;
    }
    
    .form-card {
        padding: 1.5rem 1.2rem;
        border-radius: 20px;
    }
    
    .grid-2 {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .radio-group {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
}
