/*
 * Unified Theme System for maxim-kuznetsov.com
 * Supports light and dark themes with CSS variables
 * Dark theme is default
 */

/* ============ Theme Variables ============ */

:root {
    /* Dark theme (default) */
    --bg-primary: #1a1a1a;
    --bg-secondary: #242424;
    --bg-tertiary: #2d2d2d;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --text-muted: #666666;
    --accent: #1db954;
    --accent-hover: #1ed760;
    --border: #404040;
    --shadow: rgba(0, 0, 0, 0.5);

    /* Icons opacity */
    --icon-opacity: 0.15;
    --icon-hover-opacity: 0.25;
    --icon-inactive-opacity: 0.08;
}

[data-theme="light"] {
    --bg-primary: #fff1e5;
    --bg-secondary: #ffe8d6;
    --bg-tertiary: #ffdcc4;
    --text-primary: #1a1a1a;
    --text-secondary: #555555;
    --text-muted: #999999;
    --accent: #1db954;
    --accent-hover: #18a34a;
    --border: #e0d0c0;
    --shadow: rgba(0, 0, 0, 0.1);

    --icon-opacity: 0.12;
    --icon-hover-opacity: 0.2;
    --icon-inactive-opacity: 0.05;
}

/* ============ Base Reset ============ */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--accent);
}

/* ============ Unified Header ============ */

.site-header {
    background: var(--bg-secondary);
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border);
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.site-header .logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-primary);
    text-decoration: none;
}

.site-header .logo:hover {
    color: var(--accent);
}

.site-header .tagline {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    margin-left: 1rem;
}

.site-header .left-section {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.site-header .nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.site-header .nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
    font-size: 0.95rem;
}

.site-header .nav-links a:hover,
.site-header .nav-links a.active {
    color: var(--accent);
}

.site-header .right-section {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-right: 0.5rem;
}

/* Theme Toggle Button */
.theme-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.theme-toggle:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Sun icon shown in dark mode, moon icon shown in light mode */
.theme-toggle .icon-sun {
    display: block;
}

.theme-toggle .icon-moon {
    display: none;
}

[data-theme="light"] .theme-toggle .icon-sun {
    display: none;
}

[data-theme="light"] .theme-toggle .icon-moon {
    display: block;
}

/* Mail Link */
.mail-link {
    color: var(--text-secondary);
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
}

.mail-link:hover {
    color: var(--accent);
}

.mail-link svg {
    width: 22px;
    height: 22px;
}

/* ============ Content Wrapper ============ */

.site-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* ============ Buttons ============ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:hover {
    background: var(--border);
    color: var(--text-primary);
}

.btn-primary {
    background: var(--accent);
    color: #000;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

/* ============ Cards ============ */

.card {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid var(--border);
}

/* ============ Form Elements ============ */

input[type="text"],
input[type="search"],
input[type="email"] {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

input[type="text"]:focus,
input[type="search"]:focus,
input[type="email"]:focus {
    outline: none;
    border-color: var(--accent);
}

input::placeholder {
    color: var(--text-muted);
}

/* ============ Tables ============ */

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table tr:hover td {
    background: var(--bg-tertiary);
}

/* ============ Tabs ============ */

.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.tab-btn {
    padding: 1rem 1.5rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* ============ Scrollbar ============ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============ Utility Classes ============ */

.text-muted {
    color: var(--text-muted);
}

.text-secondary {
    color: var(--text-secondary);
}

.text-accent {
    color: var(--accent);
}

.bg-secondary {
    background: var(--bg-secondary);
}

.bg-tertiary {
    background: var(--bg-tertiary);
}

/* ============ Responsive ============ */

@media (max-width: 768px) {
    .site-header {
        padding: 1rem;
    }

    .site-header .tagline {
        display: none;
    }

    .site-header .nav-links {
        gap: 1rem;
    }

    .site-content {
        padding: 1rem;
    }
}

@media (max-width: 500px) {
    .site-header .container {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .site-header .nav-links {
        font-size: 0.85rem;
    }
}