/* ===================================
   FunBox - Common Styles
   A minimalist game & entertainment toolkit
   =================================== */

/* CSS Variables */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --accent-color: #3b82f6;
    --background-color: #f8fafc;
    --surface-color: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --max-width: 1200px;
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-fast);
}

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

img {
    max-width: 100%;
    height: auto;
}

button {
    cursor: pointer;
    font-family: inherit;
    border: none;
    background: none;
}

/* ===================================
   Header & Navigation
   =================================== */
.header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.nav-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo img {
    height: 32px;
    width: auto;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.logo-text span {
    color: var(--primary-color);
}

/* Desktop Navigation */
.nav-menu {
    display: flex;
    align-items: center;
    gap: 2rem;
    list-style: none;
}

.nav-menu a {
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.5rem 0;
    position: relative;
}

.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width var(--transition-normal);
}

.nav-menu a:hover,
.nav-menu a.active {
    color: var(--primary-color);
}

.nav-menu a:hover::after,
.nav-menu a.active::after {
    width: 100%;
}

/* Mobile Navigation Toggle */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 0.5rem;
    cursor: pointer;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background-color: var(--text-primary);
    transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile Menu Overlay */
.nav-overlay {
    display: none;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.nav-overlay.active {
    opacity: 1;
    display: block;
}

/* Mobile Menu */
.mobile-menu {
    display: none;
    position: fixed;
    top: 64px;
    right: -280px;
    width: 280px;
    height: calc(100vh - 64px);
    background-color: var(--surface-color);
    z-index: 999;
    padding: 1.5rem;
    overflow-y: auto;
    transition: right var(--transition-normal);
    box-shadow: var(--shadow-lg);
}

.mobile-menu.active {
    right: 0;
}

.mobile-menu ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mobile-menu a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.mobile-menu a:hover,
.mobile-menu a.active {
    background-color: var(--background-color);
    color: var(--primary-color);
}

.mobile-menu-section {
    margin-bottom: 1.5rem;
}

.mobile-menu-section h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    padding: 0 1rem;
}

/* ===================================
   Main Content Area
   =================================== */
.main-content {
    flex: 1;
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* ===================================
   Footer
   =================================== */
.footer {
    background-color: var(--surface-color);
    border-top: 1px solid var(--border-color);
    padding: 3rem 1.5rem 1.5rem;
    margin-top: auto;
}

.footer-container {
    max-width: var(--max-width);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 3rem;
}

.footer-brand {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.footer-brand .logo {
    margin-bottom: 0.5rem;
}

.footer-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.7;
}

.footer-section h4 {
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.footer-section ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-section a {
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: color var(--transition-fast);
}

.footer-section a:hover {
    color: var(--primary-color);
}

.footer-bottom {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* ===================================
   Back to Top Button
   =================================== */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 48px;
    height: 48px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity var(--transition-normal),
        visibility var(--transition-normal),
        transform var(--transition-normal),
        background-color var(--transition-fast);
    z-index: 900;
    cursor: pointer;
}

.back-to-top:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top svg {
    width: 24px;
    height: 24px;
}

/* ===================================
   Utility Classes
   =================================== */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

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

.btn-primary:hover {
    background-color: var(--primary-hover);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--background-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

.card {
    background-color: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.text-center {
    text-align: center;
}

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

/* ===================================
   Page Header (for inner pages)
   =================================== */
.page-header {
    padding: 3rem 0;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.breadcrumb {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

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

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

/* ===================================
   Responsive Styles
   =================================== */
@media (max-width: 1024px) {
    .footer-container {
        grid-template-columns: 1fr 1fr;
    }

    .footer-brand {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {

    /* Navigation Mobile */
    .nav-menu {
        display: none;
    }

    .nav-toggle {
        display: flex;
    }

    .nav-overlay {
        display: none;
    }

    .mobile-menu {
        display: block;
    }

    /* Footer Mobile */
    .footer-container {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }

    .footer-brand {
        align-items: center;
    }

    .footer-section ul {
        align-items: center;
    }

    /* Back to Top Mobile */
    .back-to-top {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 44px;
        height: 44px;
    }

    /* Page Header Mobile */
    .page-header {
        padding: 2rem 0;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }

    /* Main Content Mobile */
    .main-content {
        padding: 1.5rem 1rem;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 14px;
    }

    .nav-container {
        padding: 0 1rem;
    }

    .footer {
        padding: 2rem 1rem 1rem;
    }

    .back-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
    }

    .back-to-top svg {
        width: 20px;
        height: 20px;
    }
}