:root {
    /* Shadcn/Zinc Palette (Light Mode Base) */
    --background: 0 0% 100%;
    --foreground: 240 10% 3.9%;
    --card: 0 0% 100%;
    --card-foreground: 240 10% 3.9%;
    --popover: 0 0% 100%;
    --popover-foreground: 240 10% 3.9%;
    --primary: 346 87% 43%;
    /* #cd163f - Approximated from existing Red */
    --primary-foreground: 355.7 100% 97.3%;
    --secondary: 240 4.8% 95.9%;
    --secondary-foreground: 240 5.9% 10%;
    --muted: 240 4.8% 95.9%;
    --muted-foreground: 240 3.8% 46.1%;
    --accent: 240 4.8% 95.9%;
    --accent-foreground: 240 5.9% 10%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 0 0% 98%;
    --border: 240 5.9% 90%;
    --input: 240 5.9% 90%;
    --ring: 346 87% 43%;
    --radius: 0.5rem;

    /* Legacy compatibility map */
    --primary-color: hsl(var(--primary));
    --primary-hover: hsl(346 87% 35%);
    --background-main: hsl(var(--background));
    /* Was #F8FAFC (slate-50) */
    --background-main: #fcfcfc;
    /* A bit more paper-like for Zinc */
    --background-main: hsl(0 0% 98%);
    /* Zinc-50-ish */
    --background-card: hsl(var(--card));
    --text-main: hsl(var(--foreground));
    --text-muted: hsl(var(--muted-foreground));
    --border-color: hsl(var(--border));
    --font-family: 'Inter', sans-serif;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

.dark-mode,
html.dark-mode {
    /* Shadcn/Zinc Palette (Dark Mode Base) */
    --background: 240 10% 3.9%;
    --foreground: 0 0% 98%;
    --card: 240 10% 3.9%;
    --card-foreground: 0 0% 98%;
    --popover: 240 10% 3.9%;
    --popover-foreground: 0 0% 98%;
    --primary: 346 87% 43%;
    --primary-foreground: 355.7 100% 97.3%;
    --secondary: 240 3.7% 15.9%;
    --secondary-foreground: 0 0% 98%;
    --muted: 240 3.7% 15.9%;
    --muted-foreground: 240 5% 64.9%;
    --accent: 240 3.7% 15.9%;
    --accent-foreground: 0 0% 98%;
    --destructive: 0 62.8% 30.6%;
    --destructive-foreground: 0 0% 98%;
    --border: 240 3.7% 15.9%;
    --input: 240 3.7% 15.9%;
    --ring: 346 87% 43%;

    /* Legacy Map Update */
    --background-main: hsl(var(--background));
    --background-card: hsl(240 5% 10%);
    /* Slightly lighter than bg */
    --border-color: hsl(var(--border));
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    border-color: hsl(var(--border));
}

body {
    font-family: var(--font-family);
    background-color: var(--background-main);
    color: var(--text-main);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.landing-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Global Link Styles - No Underlines */
a {
    text-decoration: none;
    transition: all 0.2s ease;
    color: inherit;
}

a:hover {
    opacity: 0.85;
}

/* App Layout */
.app-layout {
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--background-card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    transition: transform 0.3s ease-in-out;
    overflow: hidden;
    /* Prevent body scroll from sidebar */
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-main);
    text-decoration: none;
}

.logo-img {
    display: inline-block;
    height: 32px;
    width: 32px;
    background-color: var(--primary-color);
    -webkit-mask: url(/logo.svg) no-repeat center / contain;
    mask: url(/logo.svg) no-repeat center / contain;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.dark-mode .logo-img {
    background-color: white;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px;
    /* Slightly reduced padding */
}

.sidebar-nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
    /* Tighter gap like shadcn/sidebar */
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    font-size: 0.9rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius);
    font-weight: 500;
    transition: all 0.2s;
}

.sidebar-nav a:hover {
    background-color: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}

.sidebar-nav a.active {
    background-color: hsl(var(--secondary));
    color: var(--text-main);
    font-weight: 600;
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    background-color: var(--background-card);
}

/* Main Content Area */
.main-content {
    margin-left: 260px;
    padding: 32px;
    /* Increased padding */
    width: auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.main-header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    background-color: transparent;
    border-bottom: none;
    padding: 20px 0;
    z-index: 10;
}

.main-header .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.main-header nav ul {
    list-style: none;
    display: flex;
    gap: 20px;
    align-items: center;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Hero Section */
.hero-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0 20px;
    text-align: center;
    background-image: url('/assets/img/hero-bg.png');
    background-size: cover;
    background-position: center;
    position: relative;
    color: white;
    width: 100%;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(9, 9, 11, 0.8);
    /* Darker Zinc background */
    z-index: 1;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.site-title {
    font-size: 4.5rem;
    font-weight: 800;
    margin-bottom: 10px;
    color: white;
    letter-spacing: -0.02em;
    line-height: 1.1;
    animation: fadeInUp 0.8s ease-out forwards;
}

.hero-subtitle {
    font-size: 2.25rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: rgba(255, 255, 255, 0.95);
    animation: fadeInUp 0.8s ease-out 0.2s forwards;
    opacity: 0;
}

.hero-section p {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 40px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
    animation: fadeInUp 0.8s ease-out 0.4s forwards;
    opacity: 0;
}

.cta-group {
    display: flex;
    gap: 15px;
    justify-content: center;
    align-items: center;
    animation: fadeInUp 0.8s ease-out 0.6s forwards;
    opacity: 0;
}

/* Buttons (Shadcn Style) */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    background-color: var(--primary-color);
    color: white;
    padding: 10px 24px;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: background-color 0.2s;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    /* No transform on hover for Shadcn style */
    opacity: 0.9;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    background-color: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
    border: 1px solid transparent;
    border-radius: var(--radius);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 0.2s;
}

.btn-secondary:hover {
    background-color: hsl(var(--secondary) / 0.8);
    background-color: #f4f4f5;
    /* Manual override for light mode default */
}

.dark-mode .btn-secondary:hover {
    background-color: hsl(var(--secondary) / 0.8);
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    background-color: transparent;
    color: var(--text-main);
    padding: 10px 24px;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    margin-left: 10px;
    transition: background-color 0.2s;
}

.btn-outline:hover {
    background-color: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
    border-color: var(--border-color);
}

.btn-outline-light {
    display: inline-block;
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    padding: 10px 24px;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 600;
    margin-left: 10px;
    transition: all 0.2s;
}

.btn-outline-light:hover {
    border-color: white;
    background-color: rgba(255, 255, 255, 0.1);
}

.btn-text {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-weight: 600;
}

.btn-nav {
    display: inline-block;
    padding: 8px 24px;
    border: 1px solid white;
    color: white;
    background: transparent;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    white-space: nowrap;
}

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

.terms-check {
    display: flex;
    align-items: center;
    gap: 10px;
}

.terms-check input {
    width: auto;
}

.btn-submit {
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 1rem;
}

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

.error-alert {
    background-color: rgba(225, 29, 72, 0.1);
    border: 1px solid var(--primary-color);
    color: #fda4af;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}

/* Test Runner */
.test-runner-container {
    max-width: 800px;
    margin: 0 auto;
}

.test-progress {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-main);
}

.question-block {
    display: none;
    background-color: var(--background-card);
    padding: 30px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.question-block.active {
    display: block;
}

.question-text {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 25px;
    line-height: 1.6;
}

.options-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-label {
    display: flex;
    align-items: center;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.option-label:hover {
    border-color: var(--primary-color);
    background-color: rgba(225, 29, 72, 0.05);
}

.option-input {
    display: none;
}

.option-input:checked+.custom-checkbox {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.option-input:checked+.custom-checkbox::after {
    display: block;
}

.custom-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    margin-right: 12px;
    position: relative;
    transition: all 0.2s;
}

.custom-checkbox::after {
    content: '✓';
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 14px;
}

.option-text {
    flex: 1;
    color: var(--text-main);
}

.test-controls {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    gap: 10px;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .main-content {
        margin-left: 0;
        width: 100%;
        /* Espaço para a barra de separadores fixa em baixo */
        padding-bottom: calc(76px + env(safe-area-inset-bottom));
    }

}

@media (max-width: 768px) {
    .hero-section h1.site-title {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1.5rem;
    }

    .cta-group {
        flex-direction: column;
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }

    .btn-primary,
    .btn-outline-light {
        width: 100%;
        margin-left: 0;
        justify-content: center;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .test-controls {
        flex-direction: column;
    }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background-color: var(--background-card);
    padding: 40px;
    border-radius: 16px;
    width: 100%;
    max-width: 550px;
    position: relative;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: scaleIn 0.3s ease-out;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 5px;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background-color: var(--border-color);
    color: var(--text-main);
}

.modal-header {
    text-align: center;
    margin-bottom: 30px;
}

.modal-icon {
    width: 64px;
    height: 64px;
    background-color: rgba(225, 29, 72, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.modal-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-main);
}

.modal-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

.modal-benefits {
    list-style: none;
    margin-bottom: 30px;
    background-color: var(--background-main);
    padding: 20px;
    border-radius: 12px;
}

.modal-benefits li {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    color: var(--text-main);
    font-size: 0.95rem;
}

.modal-benefits li:last-child {
    margin-bottom: 0;
}

.benefit-icon {
    width: 20px;
    height: 20px;
    color: var(--primary-color);
    flex-shrink: 0;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Theme Toggle Global Styles */
.theme-toggle-btn {
    background: transparent;
    border: none;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.theme-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--primary-color);
    transform: scale(1.1);
}

.dark-mode .theme-toggle-btn {
    color: #fbbf24;
    /* Amber for sun */
}

.dark-mode .theme-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Online Users Sidebar */
.online-sidebar {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.online-toggle {
    background: var(--background-card);
    border: 1px solid var(--border-color);
    padding: 10px 16px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-main);
}

.online-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border-color: var(--primary-color);
}

.online-count {
    background: var(--primary-color);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    min-width: 24px;
    text-align: center;
}

.online-content {
    position: absolute;
    bottom: 60px;
    right: 0;
    width: 300px;
    background: var(--background-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: bottom right;
}

.online-sidebar.open .online-content {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.online-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--background-main);
}

.online-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-main);
}

.online-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 10px 0;
}

.online-user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    transition: background 0.2s;
}

.online-user-item:hover {
    background: var(--background-main);
}

.user-avatar-container {
    position: relative;
    width: 40px;
    height: 40px;
}

.user-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.badge-admin-small {
    position: absolute;
    bottom: -2px;
    right: -2px;
    background: var(--background-card);
    border-radius: 50%;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border: 2px solid var(--background-card);
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

.user-details {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.badge-verified-small {
    color: #10b981;
    display: inline-flex;
}

.online-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.spin {
    animation: spin 1s linear infinite;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

/* Nav Section Styles */
.nav-section {
    margin-bottom: 20px;
}

.nav-section-label {
    padding: 0 15px 8px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.submenu a:hover,
.submenu a.active {
    color: var(--primary-color);
    background-color: rgba(225, 29, 72, 0.05);
}

/* Profile Footer Styles */
.sidebar-footer {
    padding: 15px;
    border-top: 1px solid var(--border-color);
    position: relative;
    margin-top: auto;
    background-color: var(--background-card);
    /* Ensure background covers content behind */
}

.profile-menu {
    position: relative;
}

.profile-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: none;
    border: 1px solid transparent;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-main);
    transition: all 0.2s;
    min-width: 0;
    /* Allow flex shrinking */
}

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

.profile-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    /* Allow text truncation */
}

.avatar-placeholder {
    width: 32px;
    height: 32px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 2px 5px rgba(225, 29, 72, 0.2);
    flex-shrink: 0;
}

.profile-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    font-size: 0.85rem;
    overflow: hidden;
}

.profile-text .name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.profile-text .role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.profile-dropdown {
    display: none;
    position: absolute;
    bottom: calc(100% + 10px);
    left: 0;
    width: 100%;
    background: var(--background-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    padding: 6px;
    z-index: 1000;
}

.profile-dropdown.show {
    display: block;
    animation: slideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* O <button> é a entrada "Instalar app" (ver partials/sidebar.php). Partilha a
   aparência das restantes entradas em vez de trazer estilos próprios: este
   dropdown ainda é shell legado, e --pa-* não resolve fora de .pa-brand. */
.profile-dropdown a,
.profile-dropdown button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    color: var(--text-main);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.profile-dropdown button {
    width: 100%;
    font-family: inherit;
    font-weight: inherit;
    text-align: left;
    background: transparent;
    border: 0;
    cursor: pointer;
}

.profile-dropdown button[hidden] { display: none; }

.profile-dropdown a:hover,
.profile-dropdown button:hover {
    background-color: var(--background-main);
}

.profile-dropdown .text-danger {
    color: #ef4444;
}

.profile-dropdown .text-danger:hover {
    background-color: rgba(239, 68, 68, 0.1);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

.theme-toggle-btn-small {
    background: transparent;
    border: 1px solid transparent;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.theme-toggle-btn-small:hover {
    color: var(--primary-color);
    background-color: var(--background-main);
    border-color: var(--border-color);
}

.theme-toggle-btn-small:hover i {
    transform: rotate(15deg);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* O botão de menu já não é usado: abaixo de 1024px a navegação é a barra
   inferior (.pa-tabbar) e acima disso a sidebar está sempre visível. */
.mobile-toggle {
    display: none;
}

@media (max-width: 768px) {
    .main-content {
        margin-left: 0;
        padding: 20px;
        /* Espaço para a barra de separadores fixa em baixo */
        padding-bottom: calc(76px + env(safe-area-inset-bottom));
    }

}

/* Ações de conta na página de perfil (única via de logout em telemóvel) */
.pa-account-actions {
    padding: 8px;
}

/* Base partilhada por todas as ações desta secção — .pa-account-logout
   acrescenta só a cor. Botão e link têm de ficar visualmente idênticos, por
   isso o reset (borda, fundo, family) fica aqui em vez de por elemento. */
.pa-account-logout,
.pa-account-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 48px;
    padding: 12px 16px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    text-decoration: none;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.pa-account-logout {
    color: #dc2626;
}

.pa-account-logout:hover {
    background: rgba(220, 38, 38, 0.08);
}

.pa-account-action {
    color: var(--text-main);
}

.pa-account-action:hover {
    background: var(--background-main);
}

.pa-account-action[hidden] { display: none; }

/* Assinatura discreta no fim das páginas em modo sidebar (ver
   partials/mini_footer.php) — fora de .pa-brand, por isso usa as
   variáveis globais em vez dos tokens --pa-*. */
.pa-mini-footer {
    margin-top: 28px;
    padding-top: 18px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Barra fina de progresso da navegação sem recarregar (assets/js/spa-nav.js).
   Só aparece quando a resposta demora mais de ~200ms — nas trocas servidas da
   cache (3-10ms) nunca chega a ser vista, que é o ponto: um indicador que
   pisca é pior do que indicador nenhum.
   Verde literal porque o <body> está fora de .pa-brand e os tokens --pa-*
   não resolvem aqui (mesma razão do partials/guest_navbar_fix.php). */
body.pa-navigating::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 100%;
    z-index: 2000;
    background: hsl(140 65% 33%);
    transform-origin: 0 50%;
    animation: pa-nav-progress 2s cubic-bezier(0.1, 0.6, 0.3, 1) forwards;
}

.dark-mode body.pa-navigating::after {
    background: hsl(140 55% 42%);
}

/* Avança depressa até 80% e abranda: dá sinal de progresso sem prometer um
   fim que não sabemos quando chega. */
@keyframes pa-nav-progress {
    0%   { transform: scaleX(0); }
    40%  { transform: scaleX(0.6); }
    100% { transform: scaleX(0.85); }
}

@media (prefers-reduced-motion: reduce) {
    body.pa-navigating::after { animation: none; transform: scaleX(0.4); }
}

/* O painel de utilizadores online flutua em baixo à direita e ficaria por
   cima da barra de separadores — sobe o suficiente para a libertar.
   Mesmo limite da barra (≤1024px). */
@media (max-width: 1024px) {
    .online-sidebar {
        bottom: calc(70px + env(safe-area-inset-bottom));
    }
}

/* Cabeçalho de convidado em ecrãs estreitos: sem estas regras o wordmark
   "Portal do Árbitro" parte-se em três linhas dentro do espaço que sobra. */
@media (max-width: 560px) {
    .main-header {
        padding: 12px 0;
    }

    .main-header .container {
        gap: 12px;
        padding: 0 14px;
    }

    .main-header .logo {
        font-size: 1rem;
        white-space: nowrap;
        gap: 8px;
    }

    .main-header .logo-img {
        width: 26px;
        height: 26px;
    }

    .main-header nav ul {
        gap: 8px;
    }

    .main-header .btn-nav,
    .main-header .btn-primary {
        padding: 8px 14px;
        font-size: 0.85rem;
    }
}

/* Em ecrãs táteis o estado :hover fica "colado" depois do toque, deixando
   elementos deslocados. Neutraliza só os efeitos de movimento; cores e
   sombras de hover não incomodam. */
@media (hover: none) {
    .category-card-mini:hover .chevron,
    .theme-toggle-btn:hover,
    .online-toggle:hover,
    .theme-toggle-btn-small:hover i {
        transform: none;
    }
}
