/* Base Styles */
body {
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, 
        #f0fdf4 0%, 
        #dcfce7 20%, 
        #bbf7d0 40%, 
        #86efac 60%, 
        #4ade80 80%, 
        #22c55e 100%);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Animations */
@keyframes float {
    0%, 100% { 
        transform: translateY(0px); 
    }
    50% { 
        transform: translateY(-15px); 
    }
}

@keyframes pulse-glow {
    0%, 100% { 
        box-shadow: 0 0 25px rgba(16, 185, 129, 0.4); 
    }
    50% { 
        box-shadow: 0 0 50px rgba(16, 185, 129, 0.8); 
    }
}

@keyframes confetti-fall {
    0% { 
        transform: translateY(-100%) rotate(0deg); 
        opacity: 1; 
    }
    100% { 
        transform: translateY(100vh) rotate(720deg); 
        opacity: 0; 
    }
}

@keyframes bounce-in {
    0% { 
        transform: scale(0); 
        opacity: 0; 
    }
    50% { 
        transform: scale(1.1); 
    }
    100% { 
        transform: scale(1); 
        opacity: 1; 
    }
}

@keyframes spin {
    0% { 
        transform: rotate(0deg); 
    }
    100% { 
        transform: rotate(360deg); 
    }
}

@keyframes slide-up {
    0% { 
        transform: translateY(30px); 
        opacity: 0; 
    }
    100% { 
        transform: translateY(0); 
        opacity: 1; 
    }
}

@keyframes shimmer {
    0% { 
        background-position: -200% 0; 
    }
    100% { 
        background-position: 200% 0; 
    }
}

@keyframes checkmark {
    0% { 
        transform: scale(0); 
        opacity: 0; 
    }
    70% { 
        transform: scale(1.3); 
    }
    100% { 
        transform: scale(1); 
        opacity: 1; 
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Utility Classes */
.logo-float {
    animation: float 3s ease-in-out infinite;
}

.form-card {
    animation: pulse-glow 4s ease-in-out infinite;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.confetti {
    position: fixed;
    width: 12px;
    height: 12px;
    top: -10px;
    animation: confetti-fall 3s linear forwards;
    z-index: 99999;
    pointer-events: none;
}

.swal-bounce {
    animation: bounce-in 0.5s ease-out;
}

.shimmer-btn {
    background: linear-gradient(90deg, 
        #10b981 0%, 
        #34d399 25%, 
        #6ee7b7 50%, 
        #34d399 75%, 
        #10b981 100%);
    background-size: 200% 100%;
    animation: shimmer 3s linear infinite;
    border: none;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.shimmer-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.4), 
        transparent);
    animation: shimmer 2s linear infinite;
}

.loading-spinner {
    animation: spin 1s linear infinite;
    border: 4px solid rgba(16, 185, 129, 0.2);
    border-top-color: #10b981;
    border-radius: 50%;
}

.input-focus:focus {
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.3);
    outline: none;
    border-color: #10b981 !important;
    transform: translateY(-2px);
    transition: all 0.3s ease;
}

.input-focus.error-field:focus {
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.3) !important;
}

.overlay {
    backdrop-filter: blur(15px);
    background: rgba(0, 0, 0, 0.7);
}

.photo-preview {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 16px;
    border: 4px solid #10b981;
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.3);
}

.profile-card {
    animation: slide-up 0.6s ease-out;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
}

/* Fix Loading Overlay */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(15px);
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
}

#loading-overlay:not(.hidden) {
    display: flex !important;
}

#loading-overlay > div {
    background: white;
    border-radius: 1.5rem;
    padding: 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    min-width: 300px;
    max-width: 90%;
}

/* Custom Styles for Components */
#foto-preview {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(52, 211, 153, 0.1));
    border-radius: 16px;
    margin-top: 15px;
    border: 2px dashed #10b981;
}

#preview-img {
    width: 110px;
    height: 110px;
    object-fit: cover;
    border-radius: 12px;
    border: 3px solid #10b981;
    box-shadow: 0 5px 15px rgba(16, 185, 129, 0.3);
}

#remove-foto {
    background: linear-gradient(135deg, #fecaca, #fca5a5);
    color: #dc2626;
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.2);
    cursor: pointer;
}

#remove-foto:hover {
    background: linear-gradient(135deg, #fca5a5, #f87171);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.3);
}

#error-message {
    display: none;
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    border: 2px solid #f87171;
    border-left: 6px solid #dc2626;
    box-shadow: 0 5px 15px rgba(220, 38, 38, 0.1);
    border-radius: 1rem;
    padding: 1rem;
}

#error-message:not(.hidden) {
    display: block;
    animation: slideDown 0.3s ease-out;
}

#error-message ul {
    margin: 0.5rem 0 0 0;
    padding-left: 1.5rem;
}

#error-message li {
    margin-bottom: 0.25rem;
}

#success-modal {
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(20px);
}

#success-modal:not(.hidden) {
    opacity: 1;
}

/* Required field indicator */
.required-label::after {
    content: " *";
    color: #ef4444;
}

/* Error Field Styling */
.error-field {
    border-color: #ef4444 !important;
    animation: shake 0.5s ease-in-out;
}

/* Enhanced radio button error state */
.jenis-kelamin-card.error-field,
.jenjang-card.error-field,
.jalur-card.error-field {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2) !important;
}

/* Jenjang Card Selected dengan Ceklis Hijau */
.jenjang-card {
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.jenjang-option input:checked + .jenjang-card {
    box-shadow: 0 15px 35px rgba(16, 185, 129, 0.3);
    border-color: #10b981 !important;
    transform: translateY(-5px) scale(1.02);
    background: linear-gradient(135deg, 
        rgba(16, 185, 129, 0.1), 
        rgba(16, 185, 129, 0.05)) !important;
}

/* Ceklis untuk semua pilihan radio */
.jenjang-option input:checked + .jenjang-card::after,
.jalur-option input:checked + .jalur-card::after,
.jenis-kelamin-option input:checked + .jenis-kelamin-card::after {
    content: '✓';
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    background: #10b981;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    animation: checkmark 0.3s ease-out;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    z-index: 10;
}

/* Warna berbeda untuk setiap jenjang saat dipilih */
.jenjang-option input:checked + .jenjang-card[class*="from-purple"]::after {
    background: #8b5cf6;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.jenjang-option input:checked + .jenjang-card[class*="from-amber"]::after {
    background: #f59e0b;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.jenjang-option input:checked + .jenjang-card[class*="from-cyan"]::after {
    background: #06b6d4;
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.4);
}

/* Warna berbeda untuk setiap jalur saat dipilih */
.jalur-option input:checked + .jalur-card[class*="from-green"]::after {
    background: #22c55e;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

.jalur-option input:checked + .jalur-card[class*="from-red"]::after {
    background: #ef4444;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.jalur-option input:checked + .jalur-card[class*="from-blue"]::after {
    background: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

/* Warna berbeda untuk jenis kelamin saat dipilih */
.jenis-kelamin-option input:checked + .jenis-kelamin-card[class*="border-blue"]::after {
    background: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.jenis-kelamin-option input:checked + .jenis-kelamin-card[class*="border-pink"]::after {
    background: #ec4899;
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.4);
}

/* Hover effects untuk jenjang cards */
.jenjang-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.2);
}

/* Hover effects untuk jalur cards */
.jalur-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.2);
}

/* Radio Button Styling untuk Jenis Kelamin */
.jenis-kelamin-option input:checked + .jenis-kelamin-card {
    border-color: #10b981 !important;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(52, 211, 153, 0.1));
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.2);
    transform: translateY(-2px);
}

label:has(.jenis-kelamin-radio) {
    transition: all 0.3s ease;
    cursor: pointer;
}

label:has(.jenis-kelamin-radio:hover) {
    border-color: #34d399 !important;
    background: linear-gradient(135deg, rgba(52, 211, 153, 0.05), rgba(52, 211, 153, 0.02));
}

/* Ceklis untuk Jalur Terpilih */
.jalur-option input:checked + .jalur-card {
    box-shadow: 0 15px 35px rgba(16, 185, 129, 0.3);
    border-color: #10b981 !important;
    transform: translateY(-5px) scale(1.02);
    background: linear-gradient(135deg, 
        rgba(16, 185, 129, 0.1), 
        rgba(16, 185, 129, 0.05)) !important;
}

/* Form Validation */
input:invalid, select:invalid {
    border-color: #f87171 !important;
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.2);
}

input:valid, select:valid {
    border-color: #34d399 !important;
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.2);
}

/* Loading State */
#submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    animation: none;
}

/* Stats cards gradient */
.bg-gradient-to-br {
    transition: all 0.3s ease;
}

.bg-gradient-to-br:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

/* Responsive Design */
@media (max-width: 640px) {
    .form-card {
        padding: 1.5rem !important;
        margin: 0 0.5rem;
    }
    
    .photo-preview {
        width: 90px;
        height: 90px;
    }
    
    #preview-img {
        width: 90px;
        height: 90px;
    }
    
    .jenjang-card {
        padding: 1rem 0.5rem;
    }
    
    .jenjang-card i {
        font-size: 1.5rem !important;
    }
    
    .jenjang-option input:checked + .jenjang-card::after,
    .jalur-option input:checked + .jalur-card::after,
    .jenis-kelamin-option input:checked + .jenis-kelamin-card::after {
        width: 20px;
        height: 20px;
        font-size: 12px;
        top: 8px;
        right: 8px;
    }
    
    #loading-overlay > div {
        padding: 1.5rem;
        margin: 1rem;
        min-width: unset;
    }
}

/* Desktop Layout */
@media (min-width: 1024px) {
    .desktop-layout {
        display: grid;
        grid-template-columns: 2fr 1fr;
        gap: 2.5rem;
    }
}

/* Glass effect untuk semua cards */
.bg-white\/95 {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* Success modal gradient */
.bg-gradient-to-r.from-emerald-500.to-teal-500 {
    background: linear-gradient(135deg, #10b981 0%, #0d9488 50%, #059669 100%);
    box-shadow: 0 15px 35px rgba(16, 185, 129, 0.3);
}

/* Style untuk header gradient */
.bg-gradient-to-r.from-emerald-600.to-teal-600 {
    background: linear-gradient(135deg, 
        #059669 0%, 
        #047857 25%, 
        #065f46 50%, 
        #064e3b 75%, 
        #022c22 100%);
    box-shadow: 0 10px 30px rgba(4, 120, 87, 0.3);
}

/* Style untuk button aksi di header */
.bg-white\/20 {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.bg-white\/20:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Style untuk badge stats */
.bg-white\/10 {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(16, 185, 129, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #10b981, #059669);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #059669, #047857);
}

/* Print Styles */
@media print {
    .form-card,
    .profile-card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
    
    #loading-overlay,
    #success-modal,
    button,
    input,
    select {
        display: none !important;
    }
    
    body {
        background: white !important;
    }
}

/* Floating particles effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(16, 185, 129, 0.1) 0px, transparent 50px),
        radial-gradient(circle at 80% 70%, rgba(52, 211, 153, 0.08) 0px, transparent 40px),
        radial-gradient(circle at 40% 80%, rgba(6, 230, 130, 0.06) 0px, transparent 60px);
    z-index: -1;
}

/* Tambahan untuk transisi smooth */
* {
    transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}

/* SweetAlert2 z-index fix */
.swal2-container {
    z-index: 1000000 !important;
}

/* Form element base styles */
input, button, select, textarea {
    font-family: 'Poppins', sans-serif;
}

/* Focus outline removal for better visual */
*:focus {
    outline: none;
}

/* Better selection color */
::selection {
    background-color: rgba(16, 185, 129, 0.3);
    color: #065f46;
}

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .form-card,
    .profile-card {
        border: 2px solid #000 !important;
    }
    
    .input-focus {
        border-width: 2px !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .form-card,
    .profile-card,
    .bg-white\/95 {
        background: rgba(30, 30, 30, 0.95) !important;
        color: #ffffff !important;
        border-color: #444 !important;
    }
    
    input, select, textarea {
        background: #222 !important;
        color: #fff !important;
        border-color: #555 !important;
    }
}

/* Ensure proper spacing for form elements */
.form-card > * + * {
    margin-top: 1.25rem;
}

/* Animation for newly added profile cards */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate__fadeInDown {
    animation: fadeInDown 0.5s ease-out;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    body {
        background-size: 800% 800%;
    }
    
    .shimmer-btn {
        animation-duration: 4s;
    }
}

/* Fix for iOS Safari */
@supports (-webkit-touch-callout: none) {
    .form-card {
        backdrop-filter: none;
        background: rgba(255, 255, 255, 0.98);
    }
}


/* FIX SWEETALERT2 STYLING */
.swal2-popup {
    max-width: 90% !important;
    width: auto !important;
    min-width: 300px !important;
    border-radius: 1.5rem !important;
    padding: 1.5rem !important;
}

.swal2-container {
    z-index: 99999 !important;
}

/* FIX LOADING OVERLAY */
#loading-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.7) !important;
    backdrop-filter: blur(10px) !important;
    display: none !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 999999 !important;
}

#loading-overlay.show {
    display: flex !important;
}

/* Better form validation styling */
.error-field {
    border-color: #ef4444 !important;
    background-color: rgba(239, 68, 68, 0.05) !important;
    animation: shake 0.5s ease-in-out;
}

.error-field:focus {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2) !important;
}

/* Remove conflicting styles */
.swal2-title {
    margin-bottom: 0.5em !important;
}

.swal2-html-container {
    margin: 1em 0 !important;
}




/* FORCE FIX - Pastikan semua tombol SweetAlert2 bisa diklik */
.swal2-actions button {
    pointer-events: auto !important;
    cursor: pointer !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
}

.swal2-cancel {
    pointer-events: auto !important;
    cursor: pointer !important;
}

.swal2-popup {
    overflow: visible !important;
}

.swal2-container.swal2-backdrop-show,
.swal2-container.swal2-noanimation {
    backdrop-filter: none !important;
}