:root {
    --bg-color: #f8fafc;
    --text-color: #0f172a;
    --card-bg: #ffffff;
    --card-border: rgba(0, 0, 0, 0.08);
    --accent-color: #2563eb;
    --accent-hover: #1d4ed8;
    --ad-bg: rgba(0, 0, 0, 0.02);
    --ad-border: rgba(0, 0, 0, 0.05);
    --sidebar-width: 290px;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Lato', sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

header {
    text-align: center;
    padding: 15px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: #0a1424;
    backdrop-filter: none;
}

h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #ffffff, #60a5fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Mobile Hamburger Menu Toggle Button */
.menu-toggle {
    display: none;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    position: absolute;
    left: 20px;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: all 0.2s ease;
    z-index: 1001;
}

.menu-toggle:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: #ffffff;
    box-shadow: 0 0 12px rgba(37, 99, 235, 0.4);
}

.layout-container {
    flex: 1;
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr) 300px;
    gap: 40px;
    padding: 0 40px 40px 0;
    width: 100%;
    box-sizing: border-box;
}

/* Left Sidebar Styling */
.sidebar {
    background: #0a1424;
    border: none;
    border-radius: 0;
    padding: 40px 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    transition: transform 0.3s ease, left 0.3s ease;
    z-index: 999;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    cursor: pointer;
    border: 1px solid transparent;
}

.nav-item:hover {
    color: #ffffff;
    background: transparent;
}

.nav-item.active {
    color: var(--accent-color);
    background: transparent;
    border-color: transparent;
}

.nav-item.external {
    margin-top: 0;
    border-top: none;
    padding: 8px 16px;
    border-radius: 10px;
}

.nav-item.external:hover {
    background: transparent;
    color: #ffffff;
}

/* Submenu Nesting Styles */
.nav-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item-parent {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: #94a3b8;
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 10px;
    background: transparent;
    border: none;
    user-select: none;
    transition: all 0.2s ease;
    text-decoration: none;
}

.nav-item-parent {
    cursor: pointer;
}

.nav-item-parent:hover {
    color: #ffffff;
    background: transparent;
}

.nav-item-parent.active {
    color: var(--accent-color);
    background: transparent;
}

.nav-submenu {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-left: 14px;
    border-left: 2px solid rgba(255, 255, 255, 0.08);
    margin-left: 20px;
    margin-top: 4px;
    margin-bottom: 0px;
}

.nav-subitem {
    display: block;
    padding: 8px 16px;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.88rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.nav-subitem:hover {
    color: #ffffff;
    background: transparent;
}

.nav-subitem.active {
    color: var(--accent-color);
    background: transparent;
}

/* Sidebar Section Title */
.sidebar-section-title {
    color: #475569;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-top: 24px;
    margin-bottom: 6px;
    padding-left: 16px;
}

.quick-access-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-section-title.quick-access-title {
    margin-top: 24px;
    margin-bottom: 2px;
}

/* Main Content & Section Layouts */
.main-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 30px;
    min-height: 600px;
    padding-top: 40px;
}

/* Card and Components styling */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 30px;
    width: 100%;
    max-width: 960px;
    box-sizing: border-box;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: border-color 0.3s, box-shadow 0.3s;
}

.card-clickable {
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
    transition: all 0.2s ease;
}

.card-clickable:hover {
    transform: translateY(-3px);
    border-color: var(--accent-color);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
}

.card-header {
    margin-bottom: 20px;
}

.card-title {
    margin: 0;
    font-size: 2.8rem;
    font-weight: 300;
    color: var(--accent-color);
    text-align: center;
    letter-spacing: 0.5px;
}

.card-description {
    color: #475569;
    line-height: 1.6667;
    margin: 0;
    font-size: 0.92rem;
}

/* Ad Spaces */
.ad-space {
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(0, 0, 0, 0.3);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: transparent;
    border: none;
}

.ad-sidebar {
    height: 600px;
    position: sticky;
    top: 30px;
    width: 300px;
}

.ad-bottom {
    width: 100%;
    max-width: 960px;
    height: 90px;
    margin-top: 20px;
}

/* Tab: Categorias Grid Design */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    width: 100%;
    max-width: 960px;
    margin-top: 20px;
}

.category-card {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
}

.category-card:hover {
    background: rgba(15, 23, 42, 0.6);
    border-color: var(--accent-color);
}

.category-num {
    font-size: 0.8rem;
    color: #64748b;
    font-weight: 700;
}

.category-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: #0f172a;
}

/* Tab: Modelo & Artigos Sub-elements */
.rules-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 25px;
}

.rule-box {
    background: #f8fafc;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    padding: 20px;
}

.rule-box h3 {
    margin: 0 0 8px 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a;
}

.rule-box p {
    margin: 0;
    color: #475569;
    font-size: 0.92rem;
    line-height: 1.6667;
}

.comparison-table {
    width: 100%;
    margin-top: 25px;
    border-collapse: collapse;
}

.comparison-table th {
    text-align: left;
    color: var(--accent-color);
    padding: 10px 14px;
    border-bottom: 2px solid rgba(0, 0, 0, 0.08);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.comparison-table td {
    padding: 14px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    font-size: 0.92rem;
}

.comp-wrong {
    color: #ef4444;
    opacity: 0.75;
}

.comp-right {
    color: #22c55e;
    font-weight: 600;
}

/* Mobile overlay backdrop */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 998;
}

/* Games Grid & Elegant Cards */
.welcome-container {
    text-align: center;
    margin-bottom: 30px;
    width: 100%;
    max-width: 960px;
}

.welcome-title {
    font-size: 2rem;
    font-weight: 300;
    color: var(--text-color);
    margin-top: 0;
    margin-bottom: 10px;
    letter-spacing: -0.5px;
}

.welcome-subtitle {
    font-size: 1rem;
    color: #64748b;
    margin: 0;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    width: 100%;
    max-width: 960px;
    box-sizing: border-box;
}

.game-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 32px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    position: relative;
    overflow: hidden;
}

.game-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-color);
    box-shadow: 0 20px 25px -5px rgba(37, 99, 235, 0.15), 0 10px 10px -5px rgba(37, 99, 235, 0.05);
}

.game-card-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(37, 99, 235, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    color: var(--accent-color);
    transition: all 0.3s ease;
}

.game-card:hover .game-card-icon-wrapper {
    background: var(--accent-color);
    color: #ffffff;
}

.game-icon {
    width: 24px;
    height: 24px;
}

.game-card-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 12px;
    color: var(--text-color);
}

.game-card-description {
    font-size: 0.95rem;
    color: #64748b;
    line-height: 1.6;
    margin: 0 0 24px 0;
    flex: 1;
}

.game-card-action {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent-color);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: gap 0.2s ease;
}

.game-card-action span {
    transition: transform 0.2s ease;
    display: inline-block;
}

.game-card:hover .game-card-action span {
    transform: translateX(4px);
}

/* Responsive styling */
@media (max-width: 1200px) {
    .layout-container {
        grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    }

    .ad-sidebar {
        display: none;
    }
}

@media (max-width: 768px) {
    header {
        padding: 20px;
    }

    .menu-toggle {
        display: block;
    }

    h1 {
        font-size: 1.8rem;
    }

    .layout-container {
        grid-template-columns: 1fr;
        padding: 20px;
    }

    .main-content {
        padding-top: 20px;
        padding-left: 0;
        padding-right: 0;
        gap: 20px;
        min-height: auto;
    }

    .welcome-title {
        font-size: 1.6rem;
    }

    .games-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .game-card {
        padding: 24px;
    }

    /* Sidebar behaves as drawer on mobile */
    .sidebar {
        position: fixed;
        top: 0;
        left: -320px;
        width: 280px;
        height: 100vh;
        border-radius: 0;
        border: none;
        border-right: 1px solid var(--card-border);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
        z-index: 1000;
    }

    .sidebar.open {
        left: 0;
        transform: translateX(0);
    }

    .sidebar-overlay.visible {
        display: block;
    }

    .card {
        padding: 20px;
    }

    .card-title {
        font-size: 1.3rem;
    }
}
