/* Container */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

/* Toast */
.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 260px;
    margin-bottom: 10px;
    padding: 14px 18px;
    border-radius: 14px;
    color: #fff;
    font-size: 14px;
    backdrop-filter: blur(12px);
    background: rgba(0,0,0,0.8); /* Thoda dark kiya taki light mode me dikhe */
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.4s ease;
}

/* Show */
.toast.show {
    transform: translateX(0);
    opacity: 1;
}

/* Types */
.toast.success { background: rgba(46, 204, 113, 0.95); }
.toast.error   { background: rgba(231, 76, 60, 0.95); }
.toast.info    { background: rgba(52, 152, 219, 0.95); }

/* Icon */
.toast-icon {
    font-size: 18px;
}

/* Flower Battle (Leaderboard UI Card) */
.flower-battle {
    background: #ffffff;
    color: #2d3436;
    padding: 25px;
    border-radius: 18px;
    margin-bottom: 20px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08); /* Soft shadow for light theme */
    position: relative;
    overflow: hidden;
    animation: cardPop .5s ease;
    font-family: 'Playfair Display', serif;
}

.battle-title {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 15px;
}

.battle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.player-box {
    flex: 1;
    background: #fdfaf6; /* Creamy box background */
    border: 1px solid rgba(0,0,0,0.05);
    padding: 15px;
    border-radius: 12px;
}

.player-name {
    font-size: 18px;
    font-weight: 700;
}

.player-time {
    font-size: 20px;
    margin-top: 5px;
    color: #e55039; /* Highlighted time */
}

.vs {
    font-size: 22px;
    font-weight: 700;
    color: #b2bec3;
}

.winner-text {
    margin-top: 15px;
    font-size: 22px;
    font-weight: 700;
    color: #ff4081;
}

.flower {
    position: absolute;
    top: -20px;
    font-size: 20px;
    animation: flowerFall linear infinite;
    opacity: .9;
}

@keyframes flowerFall {
    0% { transform: translateY(-20px) rotate(0deg); }
    100% { transform: translateY(350px) rotate(360deg); }
}

@keyframes cardPop {
    from { opacity: 0; transform: scale(.9) }
    to { opacity: 1; transform: scale(1) }
}

/* --- THEME VARIABLES --- */
:root {
    --glass-bg: rgba(255, 255, 255, 0.7); /* Whiter glass for creamy bg */
    --glass-border: rgba(0, 0, 0, 0.08); /* Darkish soft border */
    --text-main: #2d3436; /* Dark text */
    --text-muted: #636e72;
    --accent-color: #ff416c;
}

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

/* Animated Creamy Background */
body {
    font-family: 'Inter', sans-serif;
    /* Creamy/White soft animated gradient */
    background: linear-gradient(-45deg, #fdfaf6, #f4ecd8, #ffffff, #f9f5ec);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    overflow-x: hidden;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

h1, h2, h3 { 
    font-family: 'Playfair Display', serif; 
    font-weight: 700; 
    text-shadow: 0 1px 2px rgba(0,0,0,0.05); /* Softened shadow */
}

main {
    max-width: 600px;
    margin: auto;
    width: 100%;
}

/* Glassmorphism Containers - Adjusted for Light Theme */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 30px;
    width: 100%;
    margin-bottom: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08); /* Soft dark shadow instead of white/blue */
}

header { text-align: center; margin-bottom: 20px; }
header h1 { font-size: 3.5rem; letter-spacing: 2px; color: var(--text-main); }
header p { font-size: 1.1rem; color: var(--text-muted); margin-top: 5px; }

.input-group { margin-bottom: 20px; text-align: left; }
label { display: block; margin-bottom: 8px; font-weight: 600; color: var(--text-main); }

input[type="text"], input[type="file"] {
    width: 100%; padding: 15px; border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.1); /* Darker border */
    background: #ffffff; /* Solid white background for inputs */
    color: var(--text-main);
    font-family: 'Inter', sans-serif; font-size: 1rem;
    transition: all 0.3s;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}
input[type="text"]:focus { 
    border-color: var(--accent-color); 
    box-shadow: 0 0 10px rgba(255, 65, 108, 0.2); 
}

input[type="file"]::file-selector-button {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 99%, #fecfef 100%);
    color: var(--text-main); border: none; padding: 10px 20px;
    border-radius: 8px; cursor: pointer; font-weight: 600; margin-right: 15px;
}

button {
    width: 100%; padding: 16px; border: none; border-radius: 12px;
    font-size: 1.2rem; font-weight: 600; cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-bottom: 15px;
}
button.primary {
    background: linear-gradient(to right, #ff416c, #ff4b2b);
    color: white; 
    box-shadow: 0 4px 15px rgba(255, 75, 43, 0.3);
}
button.primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(255, 75, 43, 0.5); }

button.secondary {
    background: #ffffff; 
    color: var(--text-main);
    border: 1px solid rgba(0,0,0,0.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
button.secondary:hover { background: #fdfaf6; }

/* Loading Animation */
#processing, #result { display: none; text-align: center; }
.spinner {
    width: 60px; height: 60px; 
    border: 6px solid rgba(0,0,0,0.1); /* Dark border for light theme */
    border-top-color: var(--accent-color); 
    border-radius: 50%;
    animation: spin 1s linear infinite; margin: 0 auto 20px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- THE VIRAL CARD DESIGN (UNTOUCHED) --- */
#card-render-container {
    position: absolute; top: -9999px; left: -9999px;  width: 1080px; height:1720px;
}
.instagram-card {
    width: 1080px; height: 1720px;
    background-color: #fdfaf6;
    background-image: radial-gradient(#ffb7b2 1px, transparent 1px);
    background-size: 40px 40px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 80px; text-align: center; color: #2d3436;
    box-sizing: border-box; position: relative;
}
.floral-top { position: absolute; top: 40px; left: 40px; font-size: 80px; }
.floral-bottom { position: absolute; bottom: 40px; right: 40px; font-size: 80px; transform: scaleX(-1); }

.card-header-icon { font-size: 50px; margin-bottom: 10px; }
.card-title { font-family: 'Playfair Display', serif; font-size: 55px; font-weight: 700; color: #1e3799; letter-spacing: 4px; margin-bottom: 20px; text-transform: uppercase;}
.card-subtitle { font-family: 'Inter', sans-serif; font-size: 35px; color: #636e72; margin-bottom: 60px; }

.card-name { font-family: 'Great Vibes'; font-size: 110px; color: #e55039; margin-bottom: 40px; text-shadow: 2px 2px 4px rgba(0,0,0,0.1); line-height: 1; }
.card-time { font-family: 'Inter', sans-serif; font-size: 45px; font-weight: 600; color: #2d3436; margin-bottom: 60px; background: rgba(229, 80, 57, 0.1); padding: 15px 40px; border-radius: 50px;}

.card-shayari { font-family: 'Playfair Display', serif; font-size: 45px; font-style: italic; color: #2d3436; line-height: 1.5; padding: 0 40px; margin-bottom: 60px;}

.card-divider { font-size: 30px; letter-spacing: 5px; color: #b2bec3; margin-bottom: 20px;}
.card-footer { font-family: 'Inter', sans-serif; font-size: 30px; font-weight: 600; color: #e55039; letter-spacing: 2px;}

#generated-image-preview {
    width: 100%; border-radius: 16px; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.15); /* Softer shadow */
    margin-bottom: 25px; border: 4px solid white;
}

/* Leaderboard - Adjusted for Light Theme */
.leaderboard-table { 
    width: 100%; border-collapse: collapse; margin-top: 15px; 
    background: rgba(0,0,0,0.03); /* Light dark tint for contrast */
    border-radius: 12px; overflow: hidden;
    border: 1px solid rgba(0,0,0,0.05);
}
.leaderboard-table th, .leaderboard-table td { 
    padding: 12px; text-align: left; 
    border-bottom: 1px solid rgba(0,0,0,0.05); 
    color: var(--text-main);
}
.leaderboard-table th { 
    font-weight: 600; background: rgba(0,0,0,0.06); 
}
.rank { 
    width: 40px; font-weight: bold; 
    color: #e55039; /* Changed from yellow to bold red/orange for visibility */
    text-align: center;
}
.time { font-weight: bold; text-align: right;}
