/* ===== CSS Variables ===== */
:root {
    --bg-primary: #0a0e27;
    --bg-secondary: #121836;
    --bg-card: rgba(255, 255, 255, 0.05);
    --bg-card-hover: rgba(255, 255, 255, 0.1);
    --text-primary: #ffffff;
    --text-secondary: #a0aec0;
    --text-muted: #64748b;
    --border-color: rgba(255, 255, 255, 0.1);
    --accent: #06b6d4;
    --accent-secondary: #8b5cf6;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 40px rgba(6, 182, 212, 0.3);
}

[data-theme="light"] {
    --bg-primary: #e0f7fa;
    --bg-secondary: #b2ebf2;
    --bg-card: rgba(255, 255, 255, 0.7);
    --bg-card-hover: rgba(255, 255, 255, 0.9);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-color: rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== Background ===== */
.background-animation {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: -1;
    background: linear-gradient(180deg, #0a1628 0%, #0d2847 40%, #1a4a6e 70%, #2d6a7a 100%);
}

[data-theme="light"] .background-animation {
    background: linear-gradient(180deg, #87ceeb 0%, #5fb3d4 40%, #48a9c7 70%, #3d9cb8 100%);
}

/* ===== Fish ===== */
.fish {
    position: absolute;
    z-index: 2;
    opacity: 0.95;
    filter: drop-shadow(0 4px 15px rgba(0,0,0,0.4));
}

.fish1 { width: 120px; height: 72px; top: 15%; animation: swim1 28s linear infinite, bob1 3s ease-in-out infinite; }
.fish2 { width: 90px; height: 54px; top: 40%; animation: swim2 35s linear infinite, bob2 4s ease-in-out infinite; animation-delay: -12s; }
.fish3 { width: 70px; height: 42px; top: 55%; animation: swim3 32s linear infinite, bob3 2.5s ease-in-out infinite; animation-delay: -20s; opacity: 0.8; }

@keyframes swim1 {
    0% { left: -150px; transform: scaleX(1); }
    49% { transform: scaleX(1); }
    50% { left: calc(100% + 150px); transform: scaleX(-1); }
    99% { transform: scaleX(-1); }
    100% { left: -150px; transform: scaleX(1); }
}

@keyframes swim2 {
    0% { left: calc(100% + 100px); transform: scaleX(-1); }
    49% { transform: scaleX(-1); }
    50% { left: -100px; transform: scaleX(1); }
    99% { transform: scaleX(1); }
    100% { left: calc(100% + 100px); transform: scaleX(-1); }
}

@keyframes swim3 {
    0% { left: -80px; transform: scaleX(1); }
    49% { transform: scaleX(1); }
    50% { left: calc(100% + 80px); transform: scaleX(-1); }
    99% { transform: scaleX(-1); }
    100% { left: -80px; transform: scaleX(1); }
}

@keyframes bob1 { 0%, 100% { margin-top: 0; } 50% { margin-top: -20px; } }
@keyframes bob2 { 0%, 100% { margin-top: 0; } 50% { margin-top: 18px; } }
@keyframes bob3 { 0%, 100% { margin-top: 0; } 50% { margin-top: -12px; } }

/* ===== Waves ===== */
.wave {
    position: absolute;
    bottom: 0; left: 0;
    width: 200%; height: 200px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 320'%3E%3Cpath fill='%2306b6d4' fill-opacity='0.08' d='M0,160L48,176C96,192,192,224,288,213.3C384,203,480,149,576,149.3C672,149,768,203,864,208C960,213,1056,171,1152,149.3C1248,128,1344,128,1392,128L1440,128L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z'%3E%3C/path%3E%3C/svg%3E") repeat-x;
    background-size: 50% 100%;
    animation: wave 20s linear infinite;
}
.wave2 { opacity: 0.5; animation-duration: 15s; animation-direction: reverse; bottom: 10px; }
.wave3 { opacity: 0.3; animation-duration: 25s; bottom: 20px; }
@keyframes wave { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ===== Bubbles ===== */
.bubbles { position: absolute; width: 100%; height: 100%; overflow: hidden; }
.bubbles span {
    position: absolute; bottom: -100px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    animation: bubble 15s infinite;
}
.bubbles span:nth-child(1) { left: 10%; width: 40px; height: 40px; animation-delay: 0s; }
.bubbles span:nth-child(2) { left: 20%; width: 20px; height: 20px; animation-delay: 2s; }
.bubbles span:nth-child(3) { left: 35%; width: 50px; height: 50px; animation-delay: 4s; }
.bubbles span:nth-child(4) { left: 50%; width: 25px; height: 25px; animation-delay: 6s; }
.bubbles span:nth-child(5) { left: 65%; width: 45px; height: 45px; animation-delay: 8s; }
.bubbles span:nth-child(6) { left: 75%; width: 20px; height: 20px; animation-delay: 10s; }
.bubbles span:nth-child(7) { left: 85%; width: 35px; height: 35px; animation-delay: 12s; }
.bubbles span:nth-child(8) { left: 5%; width: 30px; height: 30px; animation-delay: 14s; }
.bubbles span:nth-child(9) { left: 45%; width: 40px; height: 40px; animation-delay: 16s; }
.bubbles span:nth-child(10) { left: 90%; width: 25px; height: 25px; animation-delay: 18s; }
@keyframes bubble { 0% { transform: translateY(0) scale(1); opacity: 0.6; } 100% { transform: translateY(-100vh) scale(1.3); opacity: 0; } }

/* ===== Ocean Floor ===== */
.ocean-floor {
    position: absolute;
    bottom: 0; left: 0;
    width: 100%; height: 180px;
    z-index: 1;
}

.sand {
    position: absolute;
    bottom: 0; left: 0;
    width: 100%; height: 40px;
    background: linear-gradient(180deg, #c9a962 0%, #b8956e 50%, #a07d5a 100%);
    border-radius: 100% 100% 0 0 / 20px 20px 0 0;
}

/* ===== Corals ===== */
.coral {
    position: absolute;
    bottom: 30px;
    z-index: 2;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.3));
}

.coral1 { left: 5%; width: 100px; height: 120px; }
.coral2 { left: 70%; width: 80px; height: 100px; }
.coral3 { left: 45%; width: 70px; height: 90px; }

/* ===== Seaweed ===== */
.seaweed {
    position: absolute;
    bottom: 35px;
    z-index: 1;
    transform-origin: bottom center;
}

.seaweed1 { left: 15%; width: 30px; height: 150px; animation: sway1 4s ease-in-out infinite; }
.seaweed2 { left: 25%; width: 25px; height: 120px; animation: sway2 5s ease-in-out infinite; animation-delay: -1s; }
.seaweed3 { left: 60%; width: 20px; height: 100px; animation: sway1 3.5s ease-in-out infinite; animation-delay: -2s; }
.seaweed4 { left: 80%; width: 28px; height: 130px; animation: sway2 4.5s ease-in-out infinite; animation-delay: -0.5s; }
.seaweed5 { left: 92%; width: 22px; height: 90px; animation: sway1 3s ease-in-out infinite; animation-delay: -1.5s; }

@keyframes sway1 {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
}

@keyframes sway2 {
    0%, 100% { transform: rotate(4deg); }
    50% { transform: rotate(-4deg); }
}

/* ===== Rocks ===== */
.rock {
    position: absolute;
    bottom: 25px;
    border-radius: 50% 50% 45% 45%;
    z-index: 3;
}

.rock1 {
    left: 35%; width: 60px; height: 35px;
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 50%, #374151 100%);
}

.rock2 {
    left: 38%; width: 40px; height: 25px; bottom: 35px;
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 50%, #4b5563 100%);
}

.rock3 {
    left: 85%; width: 50px; height: 30px;
    background: linear-gradient(135deg, #78716c 0%, #57534e 50%, #44403c 100%);
}

/* ===== Shells ===== */
.shell {
    position: absolute;
    bottom: 35px;
    z-index: 3;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.3));
}

.shell1 { left: 52%; width: 35px; height: 25px; transform: rotate(-10deg); }
.shell2 { left: 75%; width: 30px; height: 22px; transform: rotate(15deg); }

/* ===== Container ===== */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 10;
}

/* ===== Header ===== */
header { text-align: center; padding: 3rem 0; position: relative; }

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.logo-icon {
    width: 80px; height: 80px;
    background: linear-gradient(135deg, #e63946, #ff6b6b);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 40px rgba(230, 57, 70, 0.4);
    animation: float 3s ease-in-out infinite;
}

.logo-icon svg { width: 48px; height: 48px; color: white; }

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

h1 { font-size: 3rem; font-weight: 800; letter-spacing: -1px; }
h1 .domain {
    background: linear-gradient(135deg, #e63946, #ff6b6b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle { color: var(--text-secondary); font-size: 1.2rem; margin-top: 0.5rem; }

/* ===== Theme Toggle ===== */
.theme-toggle {
    position: absolute;
    top: 2rem; right: 0;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 50px; height: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.theme-toggle:hover { transform: scale(1.1); background: var(--bg-card-hover); }
.theme-toggle svg { width: 24px; height: 24px; color: var(--text-primary); }
.theme-toggle .icon-moon { position: absolute; opacity: 0; }
[data-theme="light"] .theme-toggle .icon-sun { opacity: 0; }
[data-theme="light"] .theme-toggle .icon-moon { opacity: 1; }

/* ===== Section Title ===== */
.section-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}
.section-title svg { width: 24px; height: 24px; color: #e63946; }

/* ===== Apps Grid ===== */
.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* ===== App Card ===== */
.app-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 2rem;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.app-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #e63946, #ff6b6b);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.app-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: #e63946;
    box-shadow: 0 0 40px rgba(230, 57, 70, 0.3);
}

.app-card:hover::before { opacity: 0.05; }

.app-card-header { display: flex; align-items: center; gap: 1.25rem; position: relative; z-index: 1; }

.app-icon {
    width: 64px; height: 64px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.app-icon svg { width: 32px; height: 32px; }
.app-info { flex: 1; }
.app-name { font-size: 1.4rem; font-weight: 700; margin-bottom: 0.25rem; }
.app-description { color: var(--text-secondary); font-size: 0.95rem; line-height: 1.5; }

.app-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    position: relative;
    z-index: 1;
}

.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--text-muted); }
.status-dot.online { background: #10b981; box-shadow: 0 0 10px #10b981; animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

.app-arrow { margin-left: auto; transition: transform 0.3s ease; }
.app-arrow svg { width: 20px; height: 20px; }
.app-card:hover .app-arrow { transform: translateX(5px); }

/* ===== Loading & No Apps ===== */
.loading, .no-apps {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 4rem;
    color: var(--text-secondary);
}

.loading svg, .no-apps svg { width: 48px; height: 48px; color: #e63946; }
.spinner { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Footer ===== */
footer {
    text-align: center;
    margin-top: auto;
    padding: 2rem 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

footer a { color: #e63946; text-decoration: none; }
footer a:hover { text-decoration: underline; }
footer .heart { width: 16px; height: 16px; color: #e63946; vertical-align: middle; display: inline; animation: heartbeat 1.5s infinite; }
@keyframes heartbeat { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.2); } }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .container { padding: 1rem; }
    h1 { font-size: 2rem; }
    .logo-icon { width: 60px; height: 60px; }
    .logo-icon svg { width: 36px; height: 36px; }
    .apps-grid { grid-template-columns: 1fr; }
    .theme-toggle { top: 1rem; right: 1rem; width: 44px; height: 44px; }
    .fish1 { width: 80px; height: 48px; }
    .fish2 { width: 60px; height: 36px; }
    .fish3 { width: 50px; height: 30px; }
    .ocean-floor { height: 120px; }
    .coral1 { width: 70px; height: 84px; }
    .coral2 { width: 60px; height: 75px; }
    .coral3 { width: 50px; height: 65px; }
    .seaweed1, .seaweed2, .seaweed3, .seaweed4, .seaweed5 { transform: scale(0.7); }
}

/* ===== Animation Delays ===== */
.app-card { opacity: 0; animation: fadeInUp 0.6s forwards; }
.app-card:nth-child(1) { animation-delay: 0.1s; }
.app-card:nth-child(2) { animation-delay: 0.2s; }
.app-card:nth-child(3) { animation-delay: 0.3s; }
.app-card:nth-child(4) { animation-delay: 0.4s; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
