* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* Loading Screen */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading.hidden {
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #764ba2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Sections */
.section {
    display: none;
    min-height: 100vh;
}

.section.active {
    display: block;
}

/* Container */
.container {
    max-width: 400px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Titles */
.title {
    font-size: 32px;
    color: white;
    text-align: center;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.subtitle {
    color: rgba(255,255,255,0.9);
    text-align: center;
    margin-bottom: 30px;
    font-size: 16px;
}

/* Forms */
.form {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: 500;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #764ba2;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* Buttons */
.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: transparent;
    color: white;
    border: 2px solid white;
}

.btn-secondary:hover {
    background: white;
    color: #764ba2;
}

.btn-block {
    width: 100%;
}

.btn-success {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    width: 100%;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

/* Switch Text */
.switch-text {
    text-align: center;
    margin-top: 20px;
    color: rgba(255,255,255,0.9);
}

.switch-text a {
    color: white;
    text-decoration: none;
    font-weight: 600;
}

.switch-text a:hover {
    text-decoration: underline;
}

/* Navbar */
.navbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.nav-brand {
    font-size: 20px;
    font-weight: 600;
}

/* Dashboard Container */
.dashboard-container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 25px;
    margin-bottom: 20px;
}

/* Cards */
.summary-card,
.add-form-card,
.history-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.summary-card {
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.summary-card h3 {
    margin-bottom: 15px;
    font-size: 18px;
    opacity: 0.9;
}

.gold-amount {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 10px;
}

.baht-amount {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 10px;
    color: #ffd700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.rupiah-savings-amount {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 10px;
    color: #4CAF50;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.rupiah-amount {
    font-size: 24px;
    margin-bottom: 15px;
    opacity: 0.9;
}

.last-update {
    font-size: 12px;
    opacity: 0.8;
}

.total-portofolio {
    font-size: 36px;
    font-weight: 700;
    margin: 15px 0;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.add-form-card h3,
.history-card h3 {
    color: #333;
    margin-bottom: 20px;
    font-size: 18px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}

.add-form-card h3 i,
.history-card h3 i {
    margin-right: 8px;
    color: #764ba2;
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    background: white;
    padding: 10px;
    border-radius: 50px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 40px;
    background: transparent;
    color: #666;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tab-btn i {
    font-size: 18px;
}

.tab-btn:hover {
    background: #f0f0f0;
}

.tab-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* History List */
.history-list {
    max-height: 400px;
    overflow-y: auto;
}

.history-item {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-item-baht {
    background: linear-gradient(to right, #fff, #fff8e7);
}

.history-item-rupiah {
    background: linear-gradient(to right, #fff, #e8f5e9);
}

.history-item:last-child {
    border-bottom: none;
}

.history-item-left {
    flex: 1;
}

.history-item-weight {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.history-item-baht .history-item-weight {
    color: #ffd700;
    font-weight: 700;
}

.history-item-rupiah .history-item-weight {
    color: #4CAF50;
    font-weight: 700;
}

.history-item-price {
    font-size: 14px;
    color: #666;
    margin-top: 3px;
}

.history-item-total {
    font-size: 14px;
    font-weight: 600;
    color: #764ba2;
}

.history-item-baht .history-item-total {
    color: #4CAF50;
}

.history-item-rupiah .history-item-total {
    color: #2E7D32;
}

.history-item-date {
    font-size: 12px;
    color: #999;
    margin-top: 3px;
}

.history-item-notes {
    font-size: 12px;
    color: #667eea;
    font-style: italic;
    margin-top: 3px;
}

.history-item-right {
    text-align: right;
    margin-left: 15px;
}

.delete-btn {
    background: none;
    border: none;
    color: #ff4444;
    cursor: pointer;
    font-size: 18px;
    padding: 5px;
    transition: color 0.3s;
}

.delete-btn:hover {
    color: #cc0000;
}

.empty-history {
    text-align: center;
    color: #999;
    padding: 30px;
}

.error-history {
    text-align: center;
    color: #ff4444;
    padding: 30px;
}

.error-history small {
    display: block;
    color: #999;
    margin-top: 10px;
    font-size: 12px;
}

/* ==================== FOOTER PREMIUM DENGAN MAHKOTA BERGERAK ==================== */
.footer {
    margin-top: 50px;
    padding: 20px;
    text-align: center;
    color: rgba(255,255,255,0.8);
    font-size: 14px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-name {
    font-weight: 700;
    background: linear-gradient(135deg, #fff, #ffd700);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
}

/* Premium Footer */
.premium-footer {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 40px 20px 30px;
    border-top: 1px solid rgba(255,215,0,0.2);
    position: relative;
    overflow: hidden;
    margin-top: 50px;
}

.premium-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, #ffd700, transparent);
}

/* Efek bintang jatuh di background */
.premium-footer::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,215,0,0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: starsMove 20s linear infinite;
    opacity: 0.3;
    pointer-events: none;
}

@keyframes starsMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(10%, 10%); }
}

.footer-decoration {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.footer-decoration i {
    font-size: 20px;
}

.footer-decoration i:nth-child(1),
.footer-decoration i:nth-child(3) {
    color: #ffd700;
    filter: drop-shadow(0 0 10px gold);
}

.footer-decoration i:nth-child(2) {
    color: #ffd700;
    font-size: 24px;
    animation: coinSpin 3s linear infinite;
}

.footer-text {
    margin-bottom: 10px;
}

.footer-symbol {
    font-size: 18px;
    margin-right: 5px;
    color: #ffd700;
}

.footer-year {
    font-size: 20px;
    font-weight: 600;
    margin-right: 10px;
    color: #fff;
}

.premium-footer .footer-name {
    font-size: 24px;
    font-weight: 800;
    background: linear-gradient(135deg, #fff, #ffd700, #fff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-size: 200% auto;
    animation: shine 3s linear infinite;
}

@keyframes shine {
    to {
        background-position: 200% center;
    }
}

.footer-rights {
    font-size: 14px;
    opacity: 0.7;
    margin-bottom: 15px;
    letter-spacing: 2px;
}

.footer-tagline {
    font-size: 16px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.footer-extra {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.footer-extra-text {
    font-size: 14px;
    font-weight: 600;
    background: linear-gradient(135deg, #ffd700, #f9e076);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 2px;
}

/* ==================== ANIMASI MAHKOTA SUPER LENGKAP ==================== */

/* 1. Mahkota Bounce (yang di tagline) */
.royal-crown-bounce {
    animation: crownBounce 1.5s ease infinite;
    filter: drop-shadow(0 0 10px #FFD700);
    font-size: 20px;
}

@keyframes crownBounce {
    0%, 100% { 
        transform: translateY(0) scale(1);
        filter: drop-shadow(0 0 5px #FFD700);
    }
    50% { 
        transform: translateY(-8px) scale(1.2);
        filter: drop-shadow(0 0 20px #FFA500);
    }
}

/* 2. Mahkota Float (di footer extra) */
.royal-crown-float {
    animation: crownFloat 3s ease-in-out infinite;
    color: #FFD700;
    font-size: 24px;
    filter: drop-shadow(0 0 5px gold);
}

.royal-crown-float:first-child {
    animation-delay: 0s;
}

.royal-crown-float:last-child {
    animation-delay: 1.5s;
}

@keyframes crownFloat {
    0% {
        transform: translateY(0px) rotate(0deg);
    }
    25% {
        transform: translateY(-5px) rotate(5deg);
    }
    50% {
        transform: translateY(-10px) rotate(0deg);
        filter: drop-shadow(0 0 20px gold);
    }
    75% {
        transform: translateY(-5px) rotate(-5deg);
    }
    100% {
        transform: translateY(0px) rotate(0deg);
    }
}

/* 3. Mahkota Kecil di dekorasi */
.royal-crown-small {
    animation: crownSmallPulse 2s ease-in-out infinite;
    color: #FFD700;
    font-size: 16px;
}

.royal-crown-small:nth-child(1) {
    animation-delay: 0s;
}

.royal-crown-small:nth-child(3) {
    animation-delay: 1s;
}

@keyframes crownSmallPulse {
    0%, 100% { 
        transform: scale(1);
        opacity: 0.8;
    }
    50% { 
        transform: scale(1.3);
        opacity: 1;
        filter: drop-shadow(0 0 15px gold);
    }
}

/* 4. Koin Berputar */
.coin-spin {
    animation: coinGlowSpin 3s linear infinite;
    color: #FFD700;
    font-size: 18px;
}

@keyframes coinGlowSpin {
    0% { 
        transform: rotateY(0deg);
        filter: drop-shadow(0 0 5px gold);
    }
    50% { 
        transform: rotateY(180deg);
        filter: drop-shadow(0 0 15px orange);
    }
    100% { 
        transform: rotateY(360deg);
        filter: drop-shadow(0 0 5px gold);
    }
}

/* 5. Efek Hover buat Mahkota (opsional) */
.fa-crown:hover {
    animation: crownHover 0.5s ease infinite;
}

@keyframes crownHover {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(10deg); }
    75% { transform: rotate(-10deg); }
}

/* 6. Animasi untuk total portofolio */
.total-portofolio {
    animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% { text-shadow: 0 0 10px rgba(255,255,255,0.5); }
    50% { text-shadow: 0 0 30px rgba(255,215,0,0.8); }
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 10000;
    animation: slideIn 0.3s ease;
}

.notification.success {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
}

.notification.error {
    background: linear-gradient(135deg, #f44336 0%, #da190b 100%);
}

.notification.info {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
}

.notification.warning {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-container {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .navbar {
        padding: 15px;
    }
    
    .tab-navigation {
        flex-direction: column;
        border-radius: 15px;
    }
    
    .tab-btn {
        justify-content: flex-start;
    }
    
    .total-portofolio {
        font-size: 28px;
    }
    
    .gold-amount,
    .baht-amount,
    .rupiah-savings-amount {
        font-size: 36px;
    }
    
    .footer {
        margin-top: 30px;
        padding: 15px;
    }
    
    .premium-footer {
        padding: 30px 15px 20px;
    }
    
    .premium-footer .footer-name {
        font-size: 20px;
    }
    
    .footer-extra {
        flex-direction: column;
        gap: 10px;
    }
}