:root {
    /* Light mode (default) */
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --dark: #1e293b;
    --light: #f8fafc;
    --gray: #94a3b8;
    --border: #e2e8f0;
    --success: #10b981;
    --error: #ef4444;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --shadow: rgba(0, 0, 0, 0.07);
    --shadow-hover: rgba(0, 0, 0, 0.1);
    --header-gradient: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    --theme-icon: '☀️';
}

[data-theme="dark"] {
    /* Dark mode */
    --primary: #3b82f6;
    --primary-dark: #1e3a8a;
    --dark: #f1f5f9;
    --light: #0f172a;
    --gray: #64748b;
    --border: #334155;
    --success: #10b981;
    --error: #f87171;
    --bg-primary: #1a202c;
    --bg-secondary: #0f172a;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-hover: rgba(0, 0, 0, 0.5);
    --header-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --theme-icon: '🌙';
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* HEADER & NAVIGATION */
header {
    background: var(--header-gradient);
    color: white;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 8px var(--shadow);
}

.navbar {
    width: 100%;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5%;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-links a {
    color: white;
    text-decoration: none;
    transition: color 0.3s ease;
    font-weight: 500;
}

.nav-links a:hover {
    color: var(--primary);
}

.nav-links .theme-toggle {
    border: none;
    padding: 0;
    font-size: 1rem;
    background: none;
    color: white;
    cursor: pointer;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    border-radius: 0;
}

.nav-links .theme-toggle:hover {
    background: none;
    color: var(--primary);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

/* MOBILE RESPONSIVE NAVIGATION */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }

    .nav-links {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(30, 41, 59, 0.98);
        flex-direction: column;
        gap: 0;
        padding: 1rem;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    .nav-links.active {
        max-height: 300px;
    }

    .nav-links li {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        padding: 1rem 0;
    }

    .nav-links li:last-child {
        border-bottom: none;
    }

    .nav-links a {
        display: block;
    }

    .nav-links .theme-toggle {
        font-size: 1.25rem;
        padding: 0;
        justify-content: flex-start;
    }
}

/* HERO SECTION */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    text-align: center;
    padding: 4rem 5%;
    margin-bottom: 3rem;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    font-weight: 800;
}

.hero p {
    font-size: 1.25rem;
    opacity: 0.95;
    max-width: 600px;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }

    .hero p {
        font-size: 1rem;
    }
}

/* TOOL GRID */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    padding: 2rem 5%;
    max-width: 1200px;
    margin: 0 auto;
}

.tool-card {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px var(--shadow);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    text-align: center;
}

.tool-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px var(--shadow-hover);
    border-color: var(--primary);
}

.tool-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.tool-card h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.tool-card p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    flex-grow: 1;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* BUTTONS */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid var(--primary);
    cursor: pointer;
    font-size: 0.95rem;
}

.btn:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: transparent;
    color: var(--primary);
}

.btn-secondary:hover {
    background-color: var(--primary);
    color: white;
}

button {
    font-family: inherit;
}

/* FOOTER */
footer {
    background: var(--light);
    color: var(--text-primary);
    padding: 2rem 5%;
    margin-top: 3rem;
    border-top: 1px solid var(--border);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.footer-links {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: var(--primary);
}

@media (max-width: 768px) {
    .footer-links {
        gap: 1rem;
        justify-content: center;
    }

    .footer-content p {
        font-size: 0.9rem;
    }
}

/* MAIN CONTENT */
main {
    min-height: calc(100vh - 100px);
    padding: 2rem 0;
}

/* FORM STYLES */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

/* UTILITY CLASSES */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 5%;
}

.section {
    padding: 3rem 5%;
}

.section h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--dark);
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 700;
    margin-bottom: 1rem;
}

/* TOOL PAGE STYLES */
.tool-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 5%;
}

.tool-header {
    text-align: center;
    margin-bottom: 2rem;
}

.tool-header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.tool-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.tool-container {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px var(--shadow);
    border: 1px solid var(--border);
}

/* TOAST NOTIFICATIONS */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    background: var(--success);
    color: white;
    border-radius: 6px;
    box-shadow: 0 4px 12px var(--shadow-hover);
    animation: slideIn 0.3s ease;
    z-index: 2000;
}

.toast.error {
    background: var(--error);
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .toast {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
    }
}

/* LINKS */
a {
    color: var(--primary);
    text-decoration: underline;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--primary-dark);
}

/* ACCESSIBILITY */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* PRINT STYLES */
@media print {
    header, footer, .btn {
        display: none;
    }
}