/* ==========================
   CSS Variables & Tokens 
========================== */
:root {
    /* Light Theme */
    --bg-color: #f8fafc;
    --text-color: #0f172a;
    --text-muted: #64748b;
    --card-bg: rgba(255, 255, 255, 0.7);
    --card-border: rgba(255, 255, 255, 0.5);
    
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --accent-color: #ec4899;
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    --font-main: 'Inter', sans-serif;
}

[data-theme="dark"] {
    /* Dark Theme */
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --card-bg: rgba(30, 41, 59, 0.7);
    --card-border: rgba(255, 255, 255, 0.1);
}

/* ==========================
   Reset & Base Styles
========================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { cursor: pointer; border: none; font-family: inherit; }

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

.gradient-text {
    background: linear-gradient(to right, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ==========================
   Navigation
========================== */
.navbar {
    padding: 1.5rem 0;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--card-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-color);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
    font-weight: 500;
}

.nav-links a {
    transition: color 0.2s ease;
}

.nav-links a:hover {
    color: var(--primary-color);
}

.theme-btn {
    background: transparent;
    color: var(--text-color);
    font-size: 1.2rem;
    padding: 0.5rem;
    border-radius: 50%;
    transition: transform 0.2s ease;
}

.theme-btn:hover {
    transform: rotate(15deg) scale(1.1);
}

/* ==========================
   Hero Section
========================== */
.hero {
    padding: 6rem 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero h1 {
    font-size: 4rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1.5rem;
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 2.5rem;
}

.cta-btn {
    display: inline-block;
    padding: 1rem 2.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 50px;
    box-shadow: 0 10px 20px -10px var(--primary-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cta-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 25px -10px var(--primary-color);
}

/* Background Glow */
.hero-bg-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, rgba(0,0,0,0) 70%);
    z-index: -1;
    pointer-events: none;
}

/* ==========================
   Tools Section
========================== */
.main-section {
    padding: 4rem 0 8rem;
}

.tabs-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 3rem;
}

.tab-btn {
    padding: 0.8rem 1.5rem;
    background: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    backdrop-filter: blur(10px);
    transition: all 0.2s ease;
}

.tab-btn:hover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Glass Panels */
.glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 3rem;
    max-width: 800px;
    margin: 0 auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.4s ease-out;
}

.tool-panel { display: none; }
.tool-panel.active { display: block; }
.hidden { display: none !important; }

/* Forms & Inputs */
.tool-panel h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.tool-panel > p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.input-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.input-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

input[type="text"], textarea {
    width: 100%;
    padding: 1rem;
    background: rgba(0,0,0,0.05);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    color: var(--text-color);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s ease;
}

[data-theme="dark"] input[type="text"], 
[data-theme="dark"] textarea {
    background: rgba(0,0,0,0.2);
}

input[type="text"]:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.primary-btn {
    width: 100%;
    padding: 1rem;
    background: var(--primary-color);
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 12px;
    margin-top: 1rem;
    transition: background 0.2s ease, transform 0.1s ease;
}

.primary-btn:hover { background: var(--primary-hover); }
.primary-btn:active { transform: scale(0.98); }

/* Results Areas */
.results-container {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--card-border);
    animation: slideDown 0.3s ease;
}

.results-list {
    margin: 1rem 0;
    text-align: left;
}

.results-list li {
    padding: 0.8rem;
    background: rgba(0,0,0,0.05);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    border-left: 4px solid var(--primary-color);
    font-size: 0.95rem;
}

[data-theme="dark"] .results-list li { background: rgba(0,0,0,0.2); }

.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-color);
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}
.copy-btn:hover { background: var(--text-color); color: var(--bg-color); }

/* Meta Check */
.char-counter {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}
.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    background: rgba(0,0,0,0.1);
    font-size: 0.8rem;
    font-weight: 600;
}
.status-good { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.status-warn { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.status-danger { background: rgba(239, 68, 68, 0.2); color: var(--danger); }

/* Density Dashboard */
.dashboard-results {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    text-align: center;
}
.stat-box {
    padding: 1.5rem;
    background: rgba(0,0,0,0.05);
    border-radius: 16px;
}
[data-theme="dark"] .stat-box { background: rgba(0,0,0,0.2); }
.stat-box h4 { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.stat-box p { font-size: 1.8rem; font-weight: 700; color: var(--primary-color); }
.highlight-box { border: 2px solid var(--primary-color); position: relative; }
#density-eval {
    position: absolute;
    top: -12px;
    right: -12px;
    padding: 0.25rem 0.75rem;
    background: var(--primary-color);
    color: white;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: bold;
}

/* Tags Box */
.tags-output-box {
    padding: 1.5rem;
    background: rgba(0,0,0,0.05);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    font-family: monospace;
    font-size: 0.9rem;
    line-height: 1.8;
    word-break: break-all;
    margin-bottom: 1rem;
    text-align: left;
}
[data-theme="dark"] .tags-output-box { background: rgba(20,20,20,0.4); }

/* ==========================
   Footer
========================== */
footer {
    background: rgba(0,0,0,0.02);
    border-top: 1px solid var(--card-border);
    padding: 4rem 0 2rem;
}
[data-theme="dark"] footer { background: rgba(0,0,0,0.2); }
.footer-content { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 2rem; }
.footer-brand h3 { font-size: 1.5rem; color: var(--primary-color); margin-bottom: 0.5rem; }
.footer-brand p { color: var(--text-muted); }
.footer-links { display: flex; gap: 1.5rem; }
.footer-links a { color: var(--text-muted); transition: color 0.2s; }
.footer-links a:hover { color: var(--primary-color); }
.footer-bottom { text-align: center; margin-top: 3rem; color: var(--text-muted); font-size: 0.9rem; border-top: 1px solid var(--card-border); padding-top: 2rem; }

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* Responsive */
@media (max-width: 768px) {
    .hero h1 { font-size: 2.5rem; }
    .dashboard-results { grid-template-columns: 1fr; }
    .footer-content { flex-direction: column; text-align: center; }
    .footer-links { justify-content: center; flex-wrap: wrap; }
}
