:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --text-primary: #1d1f27;
    --text-secondary: #5f6368;
    
    /* Light Mode Glassmorphism Variables */
    --glass-bg: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(255, 255, 255, 0.4);
    --border-color: #dadce0;
}

body.dark {
    --text-primary: #e8eaed;
    --text-secondary: #a8b0b9;
    --border-color: #333644;
    
    /* Dark Mode Glassmorphism Variables */
    --glass-bg: rgba(20, 24, 34, 0.75);
    --glass-border: rgba(255, 255, 255, 0.05);
}

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

body { 
    font-family: 'Roboto', sans-serif; 
    color: var(--text-primary); 
    min-height: 100vh; 
    overflow: hidden; 
    position: relative;
    transition: color 0.8s ease-in-out;
    background: #f0f2f5; /* Fallback */
}

/* =========================================
   SMOOTH 1.2s BACKGROUND CROSSFADE 
========================================= */
body::before, body::after {
    content: "";
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background-size: cover;
    background-position: center;
    transition: opacity 1.2s ease-in-out;
    z-index: -1;
}

/* Light Mode Wallpaper: Soothing Daytime Sky */
body::before {
    background-image: url('https://images.unsplash.com/photo-1509803874385-db7c23652552?q=80&w=2000&auto=format&fit=crop');
    opacity: 1;
}

/* Dark Mode Wallpaper: Starry Night */
body::after {
    background-image: url('https://images.unsplash.com/photo-1475274047050-1d0c0975c63e?q=80&w=2000&auto=format&fit=crop');
    opacity: 0;
}

/* Toggle Logic */
body.dark::before { opacity: 0; }
body.dark::after { opacity: 1; }

/* CONTAINER */
.browser-container { display: flex; flex-direction: column; height: 100vh; position: relative; z-index: 1;}

/* UTILITY: GLASS EFFECT */
.glass-effect {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: background-color 0.8s ease-in-out, border-color 0.8s ease-in-out, box-shadow 0.8s ease-in-out, transform 0.2s ease;
}

body.dark .glass-effect { box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3); }

/* TOOLBAR */
.toolbar { 
    padding: 10px 20px; display: flex; align-items: center; gap: 15px; flex-wrap: wrap; z-index: 10; 
    border-bottom: 1px solid var(--border-color);
    background: var(--glass-bg); 
    backdrop-filter: blur(16px); 
    -webkit-backdrop-filter: blur(16px);
    transition: background-color 0.8s ease-in-out, border-color 0.8s ease-in-out;
}

.logo { font-size: 1.1rem; font-weight: 600; color: var(--primary-color); white-space: nowrap; transition: 0.8s ease-in-out;}
body.dark .logo { color: #fff; }

.controls { display: flex; gap: 5px; }
.btn { background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 8px 12px; cursor: pointer; color: var(--text-primary); transition: 0.2s; font-size: 14px; }
.btn:hover { background: var(--secondary-color); color: #fff; border-color: var(--secondary-color); }

.shortcuts { display: flex; gap: 10px; border-left: 1px solid var(--border-color); padding-left: 15px; transition: 0.8s ease-in-out;}
.shortcut-btn { padding: 6px 12px; background: transparent; border: none; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--text-primary); border-radius: 6px; transition: 0.2s;}
.shortcut-btn:hover { background: rgba(0,0,0,0.05); }
body.dark .shortcut-btn:hover { background: rgba(255,255,255,0.1); }

/* URL BAR */
.url-bar { display: flex; flex: 1; min-width: 300px; background: rgba(255,255,255,0.5); border: 1px solid var(--border-color); border-radius: 20px; padding: 0 5px 0 15px; align-items: center; transition: 0.8s ease-in-out;}
body.dark .url-bar { background: rgba(0,0,0,0.3); }
.url-input { flex: 1; border: none; background: transparent; padding: 8px 0; color: var(--text-primary); outline: none; font-size: 14px; transition: 0.8s ease-in-out;}
.btn-go { margin: 3px; border-radius: 15px; border: none; background: var(--secondary-color); color: white; padding: 5px 15px; cursor: pointer; }

/* IN-BAR BUTTONS */
.btn-bookmark, .btn-popout { background: none; border: none; font-size: 16px; cursor: pointer; padding: 0 6px; color: var(--text-secondary); transition: 0.2s;}
.btn-bookmark:hover, .btn-popout:hover { transform: scale(1.1); color: var(--primary-color);}
body.dark .btn-bookmark:hover, body.dark .btn-popout:hover { color: #fff; }

/* ACCOUNT BUTTON */
.account-section { margin-left: 10px; }
.btn-profile { background: var(--secondary-color); color: white; border: none; padding: 8px 15px; border-radius: 20px; font-weight: 500; cursor: pointer; transition: 0.2s; }
.btn-profile:hover { background: #2980b9; }
.btn-profile.logged-in { background: transparent; border: 1px solid var(--border-color); color: var(--text-primary); }

/* MAIN CONTENT */
.content { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    position: relative; 
    overflow-y: auto; 
    overflow-x: hidden; 
    scroll-behavior: smooth;
    background: transparent; 
}

/* NEW TAB PAGE */
.placeholder { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    padding: 60px 20px; 
    width: 100%; 
    gap: 30px; 
}

.welcome-text { 
    font-size: 2.2rem; 
    font-weight: 500; 
    color: var(--text-primary); 
    margin-top: 10px;
    text-shadow: 0 2px 10px rgba(255,255,255,0.7);
    transition: color 0.8s ease-in-out, text-shadow 0.8s ease-in-out;
}
body.dark .welcome-text { text-shadow: 0 2px 10px rgba(0,0,0,0.9); }

.quick-actions { display: flex; justify-content: center; gap: 25px; flex-wrap: wrap; width: 100%; max-width: 1000px; }
.action-card { width: 120px; height: 120px; border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; }
.action-card:hover { transform: translateY(-5px); border-color: var(--secondary-color); }
.action-card svg { margin-bottom: 12px; transition: 0.2s; color: var(--text-primary);}
.action-card:hover svg { transform: scale(1.1); }
.action-card p { font-size: 14px; color: var(--text-primary); font-weight: 500; transition: color 0.8s ease-in-out;}

/* MODERN NEWS FEED */
.news-section { width: 100%; max-width: 1000px; margin-top: 20px; margin-bottom: 50px; }
.news-section h3 { margin-bottom: 20px; font-size: 18px; color: var(--text-primary); font-weight: 500; text-shadow: 0 1px 5px rgba(255,255,255,0.7); transition: color 0.8s ease-in-out;}
body.dark .news-section h3 { text-shadow: 0 1px 5px rgba(0,0,0,0.8); }

.news-feed { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.news-feed-card { border-radius: 16px; overflow: hidden; cursor: pointer; transition: 0.2s; }
.news-feed-card:hover { transform: translateY(-4px); border-color: var(--secondary-color); box-shadow: 0 8px 25px rgba(0,0,0,0.15); }
.news-thumbnail { width: 100%; height: 160px; object-fit: cover; display: block; border-bottom: 1px solid var(--glass-border); transition: border-color 0.8s ease-in-out;}
.news-content { padding: 15px; }
.news-source { font-size: 12px; color: var(--text-secondary); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; font-weight: 500; transition: color 0.8s ease-in-out;}
.source-icon { width: 18px; height: 18px; border-radius: 4px; display: flex; align-items: center; justify-content: center; color: white; font-weight: bold; font-size: 10px; }
.news-title { font-size: 15px; color: var(--text-primary); line-height: 1.4; font-weight: 500; transition: color 0.8s ease-in-out;}
.loading-spinner { text-align: center; padding: 20px; color: var(--text-secondary); font-size: 14px; display: none; font-weight: 500; border-radius: 8px; max-width: 200px; margin: 20px auto 0; transition: color 0.8s ease-in-out;}

/* BROWSER FRAME */
.browser-frame { width: 100%; height: 100%; border: none; background: white; z-index: 5; }

/* ANIMATED RECORD PLAYER WIDGET */
.floating-music-player { position: fixed; bottom: 25px; right: 25px; width: 300px; border-radius: 16px; z-index: 9999; overflow: hidden; }
.music-header { background: rgba(29, 185, 84, 0.9); color: white; padding: 12px 18px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; font-weight: 600; font-size: 13px; user-select: none; backdrop-filter: blur(5px);}
.music-body { display: block; }

.turntable { width: 100%; height: 120px; display: flex; justify-content: center; align-items: center; position: relative; border-bottom: 1px solid var(--glass-border);}
.turntable-base { width: 220px; height: 100px; background: rgba(200,200,200,0.5); border-radius: 12px; position: relative; box-shadow: inset 0 0 10px rgba(0,0,0,0.1), 0 5px 15px rgba(0,0,0,0.1); display: flex; align-items: center; justify-content: center; border: 1px solid var(--glass-border); transition: background-color 0.8s ease-in-out;}
body.dark .turntable-base { background: rgba(0,0,0,0.4); box-shadow: inset 0 0 10px rgba(0,0,0,0.5), 0 5px 15px rgba(0,0,0,0.5); }

.record { width: 85px; height: 85px; background: #111; border-radius: 50%; border: 3px solid #2a2a2a; position: absolute; left: 25px; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 8px rgba(0,0,0,0.4); animation: spin 4s linear infinite running; }
@keyframes spin { 100% { transform: rotate(360deg); } }
.record-grooves { position: absolute; width: 65px; height: 65px; border-radius: 50%; border: 1px solid #333; }
.record-label { width: 30px; height: 30px; background: #1db954; border-radius: 50%; border: 2px solid #fff; display: flex; align-items: center; justify-content: center; }
.record-hole { width: 6px; height: 6px; background: #fff; border-radius: 50%; }

.tonearm { position: absolute; top: 15px; right: 40px; width: 6px; height: 60px; background: #bdc3c7; border-radius: 4px; transform-origin: top center; transform: rotate(25deg); transition: transform 0.3s; z-index: 2; box-shadow: 2px 2px 5px rgba(0,0,0,0.3);}
.tonearm::after { content: ''; position: absolute; bottom: -5px; left: -4px; width: 14px; height: 20px; background: #7f8c8d; border-radius: 2px; }
.tonearm::before { content: ''; position: absolute; top: -5px; left: -4px; width: 14px; height: 14px; background: #34495e; border-radius: 50%; }

/* MODALS (Auth & Library) */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.4); backdrop-filter: blur(8px); z-index: 10000; align-items: center; justify-content: center; }
.modal-content { width: 100%; max-width: 400px; padding: 35px; border-radius: 16px; position: relative; color: var(--text-primary); transition: color 0.8s ease-in-out;}
.modal-header { text-align: center; margin-bottom: 25px; }
.modal-header h2 { font-size: 1.6rem; margin-bottom: 8px; color: var(--text-primary); transition: color 0.8s ease-in-out;}
.modal-header p { font-size: 0.95rem; color: var(--text-secondary); transition: color 0.8s ease-in-out;}
.close-btn { position: absolute; top: 15px; right: 20px; background: none; border: none; font-size: 1.8rem; cursor: pointer; color: var(--text-secondary); transition: 0.2s; }
.close-btn:hover { color: var(--accent-color, #e74c3c); }

/* AUTH FORM */
#auth-form { display: flex; flex-direction: column; gap: 15px; }
#auth-form input { padding: 14px; border-radius: 8px; border: 1px solid var(--glass-border); background: rgba(255,255,255,0.5); color: var(--text-primary); font-size: 1rem; outline: none; transition: 0.8s ease-in-out; }
body.dark #auth-form input { background: rgba(0,0,0,0.3); color: #fff; }
#auth-form input:focus { border-color: var(--secondary-color); }
.btn-submit { background: var(--secondary-color); color: white; border: none; padding: 14px; border-radius: 8px; font-size: 1rem; font-weight: 500; cursor: pointer; margin-top: 10px; transition: 0.2s; }
.btn-submit:hover { background: #2980b9; transform: translateY(-2px); }

/* LIBRARY (Bookmarks/History) UI */
.library-container { width: 100%; max-width: 800px; height: 60vh; border-radius: 16px; display: flex; flex-direction: column; position: relative; overflow: hidden;}
.library-layout { display: flex; height: 100%; }
.library-sidebar { width: 200px; border-right: 1px solid var(--glass-border); padding: 20px 0; background: rgba(0,0,0,0.02); transition: background-color 0.8s ease-in-out;}
body.dark .library-sidebar { background: rgba(255,255,255,0.02); }
.lib-tab { display: block; width: 100%; text-align: left; padding: 12px 20px; background: none; border: none; cursor: pointer; color: var(--text-primary); font-size: 15px; transition: 0.2s; }
.lib-tab:hover { background: rgba(0,0,0,0.05); }
body.dark .lib-tab:hover { background: rgba(255,255,255,0.05); }
.lib-tab.active { font-weight: bold; border-left: 4px solid var(--secondary-color); background: rgba(0,0,0,0.03); }
body.dark .lib-tab.active { background: rgba(255,255,255,0.03); }

.library-main { flex: 1; padding: 30px; overflow-y: auto; }
.lib-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; border-bottom: 1px solid var(--glass-border); padding-bottom: 10px; transition: border-color 0.8s ease-in-out;}
.lib-header h3 { color: var(--text-primary); font-weight: 500; transition: color 0.8s ease-in-out;}
.btn-clear { background: #e74c3c; color: white; border: none; padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; transition: 0.2s;}
.btn-clear:hover { background: #c0392b; }
.lib-list { list-style: none; }
.lib-list li { display: flex; justify-content: space-between; align-items: center; padding: 12px; border-bottom: 1px solid var(--glass-border); transition: border-color 0.8s ease-in-out;}
.lib-url { flex: 1; color: var(--secondary-color); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-right: 15px; transition: 0.2s;}
.lib-url:hover { text-decoration: underline; }
.lib-time { font-size: 12px; color: var(--text-secondary); margin-right: 15px; transition: color 0.8s ease-in-out;}
.btn-delete { background: none; border: none; cursor: pointer; font-size: 12px; opacity: 0.5; transition: 0.2s;}
.btn-delete:hover { opacity: 1; }
.empty-state { text-align: center; color: var(--text-secondary); padding: 40px; font-style: italic; transition: color 0.8s ease-in-out;}