/**
 * UI ENHANCEMENTS CSS
 * Styling untuk 8 fitur: Animasi, Typography, Icons, Spacing, BottomNav, Progress, Forms, Loading
 */

/* ===== CUSTOM CSS VARIABLES ===== */
:root {
    /* Spacing System */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    
    /* Typography Scale */
    --text-h1: 28px;
    --text-h2: 24px;
    --text-h3: 20px;
    --text-body: 14px;
    --text-small: 12px;
    --text-tiny: 10px;
    
    /* Transitions */
    --transition-fast: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-normal: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-slow: 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    
    /* Shadows */
    --shadow-sm: 0 4px 10px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.5);
}

/* ===== 1. ANIMASI & TRANSITIONS ===== */

/* Page transition animations */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

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

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes slide-in-left {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

/* Page smooth transition */
.page {
    animation: slideInUp var(--transition-normal);
}

.page.active {
    animation: slideInUp var(--transition-normal);
}

/* ===== 2. COLOR & TYPOGRAPHY IMPROVEMENTS ===== */

/* Heading Styles */
h1 {
    font-size: var(--text-h1);
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #818cf8 0%, #a78bfa 50%, #ec4899 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: var(--spacing-lg);
}

h2 {
    font-size: var(--text-h2);
    font-weight: 700;
    color: #cbd5e1;
    margin-bottom: var(--spacing-md);
    letter-spacing: -0.3px;
}

h3 {
    font-size: var(--text-h3);
    font-weight: 600;
    color: #e2e8f0;
    margin-bottom: var(--spacing-sm);
}

/* Body text */
p {
    font-size: var(--text-body);
    color: var(--text-sub);
    line-height: 1.6;
    margin-bottom: var(--spacing-md);
}

/* Subtitle */
.subtitle {
    font-size: var(--text-small);
    color: #94a3b8;
    font-weight: 500;
}

/* ===== 3. EMPTY STATE & ICONS ===== */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl);
    text-align: center;
    min-height: 200px;
    animation: slideInUp var(--transition-normal);
}

.empty-icon {
    font-size: 64px;
    margin-bottom: var(--spacing-lg);
    animation: bounce 2s infinite;
}

.empty-message {
    font-size: var(--text-body);
    color: var(--text-sub);
    margin: 0;
}

/* ===== 4. SPACING & LAYOUT ===== */

/* Consistent padding */
.page {
    padding-bottom: 90px !important; /* Ruang untuk bottom nav */
}

.card {
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
}

.section {
    margin-bottom: var(--spacing-xl);
}

.section-title {
    font-size: var(--text-h3);
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid var(--glass-border);
}

/* ===== 5. BOTTOM NAVIGATION ===== */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    max-width: 450px;
    height: 70px;
    background: rgba(10, 5, 20, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
    left: 50%;
    transform: translateX(-50%);
    animation: slideInUp var(--transition-normal);
}

@media (max-width: 450px) {
    .bottom-nav {
        max-width: 100%;
    }
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    background: none;
    border: none;
    color: var(--text-sub);
    cursor: pointer;
    padding: var(--spacing-sm);
    transition: all var(--transition-fast);
    font-size: 12px;
    font-weight: 600;
    width: 60px;
    height: 60px;
    border-radius: 12px;
    position: relative;
}

.nav-item i {
    font-size: 20px;
    display: block;
}

.nav-item:hover {
    color: var(--accent);
}

.nav-item.active {
    color: var(--primary);
    transform: scale(1.1);
    background: rgba(129, 140, 248, 0.1);
    box-shadow: 0 0 20px rgba(129, 140, 248, 0.3);
}

/* ===== 6. PROGRESS BAR & STEPS ===== */

.progress-container {
    margin-bottom: var(--spacing-xl);
    padding: var(--spacing-md);
    background: rgba(255, 255, 255, 0.02);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
}

.progress-steps {
    display: flex;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    gap: var(--spacing-sm);
}

.progress-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    cursor: pointer;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid var(--text-sub);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--text-sub);
    transition: all var(--transition-normal);
    margin-bottom: var(--spacing-sm);
    z-index: 2;
    position: relative;
}

.step-label {
    font-size: var(--text-tiny);
    color: var(--text-sub);
    text-align: center;
    font-weight: 600;
    transition: all var(--transition-normal);
}

/* Active step styling */
.progress-step.active .step-number {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 0 20px rgba(129, 140, 248, 0.5);
    animation: scaleIn var(--transition-normal);
}

.progress-step.active .step-label {
    color: var(--primary);
    font-weight: 700;
}

/* Completed step styling */
.progress-step.completed .step-number {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.progress-step.completed .step-number::after {
    content: '✓';
    position: absolute;
    font-size: 20px;
    font-weight: 900;
}

/* Step line */
.step-line {
    position: absolute;
    top: 20px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    transition: all var(--transition-normal);
    z-index: 1;
}

.progress-step:last-child .step-line {
    display: none;
}

.progress-step.completed .step-line {
    background: var(--success);
    box-shadow: 0 0 10px rgba(52, 211, 153, 0.5);
}

/* Progress bar */
.progress-bar {
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 3px;
    transition: width var(--transition-slow);
    box-shadow: 0 0 10px rgba(129, 140, 248, 0.5);
}

/* ===== 7. FORM ELEMENTS ===== */

.form-group {
    margin-bottom: var(--spacing-lg);
    position: relative;
}

.form-label {
    display: block;
    font-size: var(--text-small);
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: var(--spacing-sm);
    letter-spacing: 0.3px;
}

.form-input {
    width: 100%;
    padding: var(--spacing-md);
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    font-size: var(--text-body);
    transition: all var(--transition-fast);
    outline: none;
}

.form-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.form-input:focus,
.form-input.input-focused {
    background: rgba(129, 140, 248, 0.1);
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(129, 140, 248, 0.3), inset 0 0 10px rgba(129, 140, 248, 0.1);
}

/* Input validation states */
.form-input.input-valid {
    border-color: var(--success);
    box-shadow: 0 0 15px rgba(52, 211, 153, 0.2);
}

.form-input.input-invalid {
    border-color: #ef4444;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.2);
}

/* Form helper text */
.form-helper {
    font-size: var(--text-tiny);
    color: var(--text-sub);
    margin-top: var(--spacing-xs);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.form-helper.error {
    color: #ef4444;
}

.form-helper.success {
    color: var(--success);
}

.validation-icon {
    font-size: 14px;
    margin-left: auto;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.form-input.input-valid ~ .validation-icon {
    opacity: 1;
}

/* ===== 8. BUTTON LOADING STATE ===== */

.btn, button {
    padding: var(--spacing-md) var(--spacing-lg);
    border: none;
    border-radius: 12px;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    min-height: 44px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
    box-shadow: 0 8px 20px rgba(129, 140, 248, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(129, 140, 248, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

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

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border: 1px solid var(--glass-border);
}

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

/* Loading state */
.btn-loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.btn-loader-text {
    font-weight: 600;
}

/* ===== SKELETON LOADER ===== */

.skeleton-loader {
    padding: var(--spacing-md);
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    margin-bottom: var(--spacing-md);
    animation: shimmer 1.5s infinite;
    background: linear-gradient(90deg, 
        rgba(255, 255, 255, 0.05) 0%, 
        rgba(255, 255, 255, 0.15) 50%, 
        rgba(255, 255, 255, 0.05) 100%);
    background-size: 200% 100%;
}

.skeleton-line {
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    margin-bottom: var(--spacing-sm);
}

.skeleton-line:last-child {
    margin-bottom: 0;
}

/* ===== TOAST NOTIFICATIONS ===== */

.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(20, 20, 30, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: var(--spacing-md) var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    opacity: 0;
    transition: all var(--transition-normal);
    pointer-events: none;
    z-index: 999;
    max-width: 300px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.toast-icon {
    font-size: 20px;
}

.toast-text {
    font-size: var(--text-body);
    color: var(--text-main);
    font-weight: 500;
}

.toast-success {
    border-color: rgba(52, 211, 153, 0.3);
    background: rgba(20, 20, 30, 0.95);
}

.toast-error {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(20, 20, 30, 0.95);
}

.toast-info {
    border-color: rgba(129, 140, 248, 0.3);
    background: rgba(20, 20, 30, 0.95);
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */

@media (max-width: 500px) {
    :root {
        --text-h1: 24px;
        --text-h2: 20px;
        --text-h3: 18px;
    }

    .page {
        padding-bottom: 100px;
    }

    .bottom-nav {
        height: 80px;
    }

    .nav-item {
        font-size: 10px;
    }

    .progress-steps {
        gap: var(--spacing-xs);
    }

    .step-number {
        width: 36px;
        height: 36px;
        font-size: 12px;
    }

    .step-label {
        font-size: 9px;
    }
}

@media (min-width: 768px) {
    .bottom-nav {
        max-width: 480px;
    }

    .page {
        padding-bottom: 100px;
    }
}
