/* ==================== MOBILE COMPONENTS CSS ====================
   Componentes reutilizáveis para todas as páginas mobile
   ============================================================== */

/* ==================== RESET & BASE ==================== */
:root {
    --mobile-header-height: 56px;
    --mobile-header-total-height: var(--mobile-header-height);
    --mobile-color-primary: #667eea;
    --mobile-color-secondary: #f093fb;
    --mobile-color-success: #4caf50;
    --mobile-color-error: #f44336;
    --mobile-color-warning: #ff9800;
    --mobile-color-dark: #333;
    --mobile-color-light: #f5f5f5;
    --mobile-color-border: #ddd;
    --mobile-shadow: 0 2px 8px rgba(0,0,0,0.1);
    --mobile-shadow-lg: 0 4px 16px rgba(0,0,0,0.15);
}

body.mobile-page {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--mobile-color-dark);
    background: #fff;
}

/* ==================== HEADER FIXO ==================== */
.mobile-header-fixed {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--mobile-header-height);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 2px 12px rgba(102, 126, 234, 0.25);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    z-index: 1000;
    gap: 12px;
}

/* Neutralizar estilos herdados de .header-fixed do tema desktop */
.mobile-header-fixed.header-fixed {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    padding: 0 12px !important;
    box-shadow: 0 2px 12px rgba(102, 126, 234, 0.25) !important;
    height: var(--mobile-header-height) !important;
    min-height: var(--mobile-header-height) !important;
}

/* Container geral do header */
.mobile-header-fixed .container {
    width: 100%;
    max-width: 100%;
    padding: 0;
    margin: 0;
}

.mobile-header-fixed .header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
}

.hamburger-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    cursor: pointer;
    width: 40px;
    height: 40px;
    /* display controlado por style.css: none (desktop) / flex (mobile ≤768px) */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    padding: 0;
    border-radius: 8px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.hamburger-btn:active {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(0.95);
}

.hamburger-btn span {
    width: 22px;
    height: 2.5px;
    background: #ffffff;
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Search container - Elegante no centro */
.mobile-header-fixed .search-container {
    flex: 1;
    max-width: 500px;
    margin: 0 8px;
}

.mobile-header-fixed .search-form {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.mobile-header-fixed .search-form:focus-within {
    background: #ffffff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.mobile-header-fixed .search-form input[type="text"] {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 16px;
    font-size: 14px;
    color: #333;
    outline: none;
    font-family: inherit;
}

.mobile-header-fixed .search-form input[type="text"]::placeholder {
    color: #999;
    font-weight: 400;
}

.mobile-header-fixed .search-form button[type="submit"] {
    background: transparent;
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.mobile-header-fixed .search-form button[type="submit"]:active {
    transform: scale(0.9);
}

.mobile-header-fixed .search-form .search-icon {
    font-size: 18px;
    color: #667eea;
}

/* Logo do canal - à direita */
.mobile-header-fixed .channel-logo {
    height: 38px;
    width: auto;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.2s;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 4px 8px;
}

.mobile-header-fixed .channel-logo:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.25);
}

.mobile-logo {
    flex: 1;
    text-align: center;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 100px;
}

.mobile-logo img {
    max-height: 40px;
    max-width: 150px;
    object-fit: contain;
}

/* Nav menu no header - esconder em mobile */
.mobile-header-fixed .main-nav {
    display: none;
}

.mobile-search-btn {
    background: none;
    border: none;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 4px;
    transition: background 0.2s;
    color: var(--mobile-color-dark);
}

.mobile-search-btn:active {
    background: var(--mobile-color-light);
}

/* ==================== SEARCH MODAL ==================== */
.mobile-search-modal {
    position: fixed;
    top: var(--mobile-header-total-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    flex-direction: column;
    align-items: flex-start;
    z-index: 999;
    animation: slideDown 0.3s ease;
}

.mobile-search-modal[style*="display: flex"],
.mobile-search-modal.show {
    display: flex !important;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-modal-content {
    width: 100%;
    background: #fff;
    padding: 16px;
    display: flex;
    gap: 8px;
    box-shadow: var(--mobile-shadow);
}

.search-modal-content form {
    flex: 1;
    display: flex;
    gap: 8px;
}

.search-modal-content input {
    flex: 1;
    border: 1px solid var(--mobile-color-border);
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 16px;
    font-family: inherit;
}

.search-modal-content button[type="submit"] {
    background: var(--mobile-color-primary);
    color: #fff;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}

.search-modal-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==================== MAIN CONTENT ==================== */
.mobile-main {
    padding-top: var(--mobile-header-total-height);
    margin-top: 0 !important;
    padding-bottom: 20px;
    min-height: 100vh;
    background: #fafafa;
}

/* Garantir que o primeiro bloco não crie espaçamento adicional */
.mobile-main > *:first-child {
    margin-top: 0 !important;
}

/* ==================== FEED VERTICAL ==================== */
.mobile-feed {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ==================== CARDS ==================== */
.mobile-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--mobile-shadow);
    padding: 12px;
    overflow: hidden;
}

.mobile-card-image {
    width: 100%;
    height: 180px;
    background: var(--mobile-color-light);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 12px;
}

.mobile-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mobile-card-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: var(--mobile-color-dark);
    line-height: 1.4;
}

.mobile-card-description {
    font-size: 13px;
    color: #666;
    margin: 0 0 12px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mobile-card-meta {
    font-size: 12px;
    color: #999;
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.mobile-card-footer {
    margin-top: 12px;
    display: flex;
    gap: 8px;
}

.mobile-card-btn {
    flex: 1;
    padding: 10px 12px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.mobile-card-btn-primary {
    background: var(--mobile-color-primary);
    color: #fff;
}

.mobile-card-btn-primary:active {
    opacity: 0.8;
}

.mobile-card-btn-secondary {
    background: var(--mobile-color-light);
    color: var(--mobile-color-dark);
    border: 1px solid var(--mobile-color-border);
}

.mobile-card-btn-secondary:active {
    background: #eee;
}

/* ==================== DRAWER (MENU LATERAL) ==================== */
.mobile-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: #ffffff;
    z-index: 2000;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.mobile-drawer.open {
    transform: translateX(0);
}

.drawer-header {
    padding: 20px 16px;
    border-bottom: 1px solid var(--mobile-color-border);
    background: var(--mobile-color-light);
}

.user-info {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 16px;
}

.user-avatar,
.user-avatar-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--mobile-color-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.user-avatar {
    object-fit: cover;
    background: #eee;
}

.user-avatar-placeholder {
    background: #ddd;
}

.user-name {
    margin: 0;
    font-weight: 600;
    font-size: 14px;
    color: var(--mobile-color-dark);
}

.user-email {
    margin: 4px 0 0 0;
    font-size: 12px;
    color: #666;
}

.drawer-cta {
    display: block;
    padding: 10px 16px;
    background: var(--mobile-color-primary);
    color: #fff;
    text-align: center;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    margin-bottom: 8px;
}

.drawer-link {
    display: block;
    padding: 10px 16px;
    color: var(--mobile-color-dark);
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.2s;
    font-size: 14px;
    margin-bottom: 4px;
}

.drawer-link:active {
    background: var(--mobile-color-light);
}

.drawer-nav {
    padding: 12px 0;
}

.drawer-nav-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    color: var(--mobile-color-dark);
    text-decoration: none;
    transition: background 0.2s;
    border-left: 3px solid transparent;
}

.drawer-nav-item:active {
    background: var(--mobile-color-light);
    border-left-color: var(--mobile-color-primary);
}

.drawer-nav-item .icon {
    font-size: 20px;
    min-width: 24px;
}

.drawer-nav-item .text {
    font-size: 14px;
    font-weight: 500;
}

.drawer-section {
    padding: 16px;
    border-top: 1px solid var(--mobile-color-border);
}

.drawer-section-title {
    margin: 0 0 12px 0;
    font-size: 13px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
}

.drawer-avisos {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.drawer-aviso {
    background: var(--mobile-color-light);
    padding: 12px;
    border-radius: 6px;
    border-left: 3px solid var(--mobile-color-warning);
}

.drawer-aviso p {
    margin: 0 0 4px 0;
    font-size: 13px;
    font-weight: 500;
}

.drawer-aviso small {
    font-size: 11px;
    color: #999;
}

.drawer-footer-section {
    margin-top: auto;
    padding: 16px;
}

.drawer-footer-link {
    display: inline-block;
    font-size: 12px;
    color: #666;
    text-decoration: none;
    margin-right: 12px;
    margin-bottom: 8px;
}

.drawer-copyright {
    margin: 12px 0 0 0;
    font-size: 11px;
    color: #999;
}

/* ==================== OVERLAY ==================== */
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1500;
}

.mobile-overlay.show {
    opacity: 1;
    pointer-events: all;
}

/* ==================== FOOTER ==================== */
.mobile-footer {
    background: #f5f5f5;
    padding: 20px 16px;
    text-align: center;
    border-top: 1px solid var(--mobile-color-border);
    margin-top: 40px;
}

.mobile-footer-content {
    max-width: 100%;
}

.mobile-footer-copyright {
    margin: 0 0 12px 0;
    font-size: 12px;
    color: #666;
}

.mobile-footer-nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.mobile-footer-link {
    font-size: 12px;
    color: var(--mobile-color-primary);
    text-decoration: none;
    padding: 4px 8px;
}

.mobile-footer-sep {
    color: #ccc;
}

/* ==================== TABS ==================== */
.mobile-tabs {
    display: flex;
    gap: 0;
    overflow-x: auto;
    border-bottom: 1px solid var(--mobile-color-border);
    background: #fff;
    padding: 0 12px;
    scroll-behavior: smooth;
}

.mobile-tabs::-webkit-scrollbar {
    height: 2px;
}

.mobile-tabs::-webkit-scrollbar-track {
    background: transparent;
}

.mobile-tabs::-webkit-scrollbar-thumb {
    background: var(--mobile-color-border);
    border-radius: 1px;
}

.mobile-tab-btn {
    flex-shrink: 0;
    padding: 12px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #666;
    transition: all 0.2s;
    white-space: nowrap;
}

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

/* ==================== FILTER MODAL ==================== */
.mobile-filter-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    flex-direction: column;
    justify-content: flex-end;
    z-index: 1800;
}

.mobile-filter-modal.open {
    display: flex;
}

.mobile-filter-content {
    background: #fff;
    border-radius: 12px 12px 0 0;
    padding: 20px 16px;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.mobile-filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.mobile-filter-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.mobile-filter-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 24px;
    padding: 0;
}

.mobile-filter-group {
    margin-bottom: 20px;
}

.mobile-filter-group-title {
    margin: 0 0 12px 0;
    font-size: 13px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
}

.mobile-filter-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
}

.mobile-filter-option input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.mobile-filter-option label {
    cursor: pointer;
    flex: 1;
    font-size: 14px;
}

.mobile-filter-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    border-top: 1px solid var(--mobile-color-border);
    padding-top: 20px;
}

.mobile-filter-actions button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.mobile-filter-apply {
    background: var(--mobile-color-primary);
    color: #fff;
}

.mobile-filter-clear {
    background: var(--mobile-color-light);
    color: var(--mobile-color-dark);
}

/* ==================== LOADING & EMPTY STATES ==================== */
.mobile-loading {
    text-align: center;
    padding: 40px 16px;
}

.mobile-loader {
    width: 40px;
    height: 40px;
    border: 4px solid var(--mobile-color-light);
    border-top-color: var(--mobile-color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.mobile-loading-text {
    font-size: 14px;
    color: #666;
}

.mobile-empty-state {
    text-align: center;
    padding: 60px 16px 40px;
}

.mobile-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.mobile-empty-title {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--mobile-color-dark);
}

.mobile-empty-text {
    margin: 0;
    font-size: 14px;
    color: #666;
}

/* ==================== TOAST MESSAGES ==================== */
.mobile-toast-container {
    position: fixed;
    bottom: 20px;
    left: 16px;
    right: 16px;
    z-index: 10000;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.mobile-toast {
    background: #333;
    color: #fff;
    padding: 14px 18px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    font-size: 14px;
    font-weight: 500;
    max-width: 100%;
    width: 100%;
    pointer-events: all;
    animation: toastSlideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.mobile-toast-success {
    background: var(--mobile-color-success);
}

.mobile-toast-error {
    background: var(--mobile-color-error);
}

.mobile-toast-warning {
    background: var(--mobile-color-warning);
}

.mobile-toast-info {
    background: var(--mobile-color-primary);
}

@keyframes toastSlideIn {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.mobile-toast-exit {
    animation: toastSlideOut 0.3s ease forwards;
}

@keyframes toastSlideOut {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(100px);
        opacity: 0;
    }
}

/* ==================== BOTTOM SHEET ==================== */
.mobile-bottom-sheet {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.mobile-bottom-sheet.open {
    pointer-events: all;
}

.mobile-bottom-sheet-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-bottom-sheet.open .mobile-bottom-sheet-backdrop {
    opacity: 1;
}

.mobile-bottom-sheet-content {
    background: #fff;
    border-radius: 20px 20px 0 0;
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
}

.mobile-bottom-sheet.open .mobile-bottom-sheet-content {
    transform: translateY(0);
}

.mobile-bottom-sheet-handle {
    width: 40px;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
    margin: 12px auto;
    cursor: grab;
}

.mobile-bottom-sheet-handle:active {
    cursor: grabbing;
}

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

.mobile-bottom-sheet-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--mobile-color-dark);
}

.mobile-bottom-sheet-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.mobile-bottom-sheet-close:active {
    background: var(--mobile-color-light);
}

.mobile-bottom-sheet-body {
    padding: 20px;
}

/* ==================== SKELETON LOADER ==================== */
.mobile-skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: skeletonPulse 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes skeletonPulse {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.mobile-skeleton-card {
    background: #fff;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.mobile-skeleton-image {
    width: 100%;
    height: 140px;
    border-radius: 6px;
    margin-bottom: 12px;
}

.mobile-skeleton-text {
    height: 14px;
    margin-bottom: 8px;
    border-radius: 4px;
}

.mobile-skeleton-text:last-child {
    width: 60%;
    margin-bottom: 0;
}

.mobile-skeleton-title {
    height: 18px;
    width: 80%;
    margin-bottom: 12px;
}

.mobile-skeleton-horizontal {
    display: flex;
    gap: 12px;
    align-items: center;
}

.mobile-skeleton-horizontal .mobile-skeleton-image {
    width: 120px;
    height: 120px;
    flex-shrink: 0;
    margin-bottom: 0;
}

.mobile-skeleton-horizontal .mobile-skeleton-content {
    flex: 1;
}

/* ==================== EMPTY STATES ==================== */
.mobile-empty-state {
    text-align: center;
    padding: 60px 16px 40px;
}

.mobile-empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.mobile-empty-title {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--mobile-color-dark);
}

.mobile-empty-text {
    margin: 0 0 20px 0;
    font-size: 14px;
    color: #666;
    line-height: 1.6;
}

.mobile-empty-action {
    display: inline-block;
    padding: 12px 24px;
    background: var(--mobile-color-primary);
    color: #fff;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s;
}

.mobile-empty-action:active {
    opacity: 0.8;
}

/* ==================== HELPER CLASSES ==================== */
.mobile-hidden {
    display: none !important;
}

.mobile-visible-only {
    display: block;
}

@media (min-width: 768px) {
    .mobile-visible-only {
        display: none !important;
    }
}

.mobile-full-width {
    width: 100% !important;
}

.mobile-mt-1 { margin-top: 8px; }
.mobile-mt-2 { margin-top: 16px; }
.mobile-mt-3 { margin-top: 24px; }
.mobile-mb-1 { margin-bottom: 8px; }
.mobile-mb-2 { margin-bottom: 16px; }
.mobile-mb-3 { margin-bottom: 24px; }

.mobile-p-1 { padding: 8px; }
.mobile-p-2 { padding: 16px; }
.mobile-p-3 { padding: 24px; }

/* ==================== SAFE AREA (Notch Support) ==================== */
@supports (padding: max(0px)) {
    :root {
        --mobile-header-total-height: calc(
            var(--mobile-header-height)
            + max(0, env(safe-area-inset-top, 0))
            + max(0, env(safe-area-inset-bottom, 0))
        );
    }

    .mobile-header-fixed {
        padding-top: max(0, env(safe-area-inset-top, 0));
        padding-bottom: max(0, env(safe-area-inset-bottom, 0));
        padding-left: max(12px, env(safe-area-inset-left, 12px));
        padding-right: max(12px, env(safe-area-inset-right, 12px));
        height: calc(var(--mobile-header-height) + max(0, env(safe-area-inset-top, 0)));
    }

    .mobile-main {
        padding-top: var(--mobile-header-total-height);
    }

    .mobile-footer {
        padding-left: max(16px, env(safe-area-inset-left, 16px));
        padding-right: max(16px, env(safe-area-inset-right, 16px));
        padding-bottom: max(20px, env(safe-area-inset-bottom, 20px));
    }
}

/* ========================================
   MOBILE DRAWER - FULLSCREEN APP-STYLE
   Classes: .mobile-drawer-*, .drawer-*
   ======================================== */

/* Overlay do drawer */
.mobile-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.mobile-drawer-overlay.open {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

/* Header — gradient sticky */
.mobile-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    position: sticky;
    top: 0;
    z-index: 1;
}

.mobile-drawer-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.3px;
}

.mobile-drawer-close {
    background: rgba(255,255,255,0.25);
    border: none;
    color: #ffffff;
    font-size: 20px;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.mobile-drawer-close:hover {
    background: rgba(255,255,255,0.35);
}

/* Conteúdo do drawer */
.mobile-drawer-content {
    padding: 0 0 24px;
}

.mobile-drawer-section {
    margin-bottom: 8px;
}

.mobile-drawer-section-title {
    font-size: 12px;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin: 0 0 10px 0;
    padding: 16px 20px 0;
}

/* ---- User Card ---- */
.drawer-user-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #f0f4ff 0%, #e8ecf8 100%);
    border-bottom: 1px solid #e0e4f0;
}

.drawer-user-card-guest {
    justify-content: center;
    padding: 20px;
}

.drawer-user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #d0d8e8;
    flex-shrink: 0;
}

.drawer-user-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    flex: 1;
}

.drawer-user-name {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.drawer-user-badges {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.drawer-user-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(102, 126, 234, 0.12);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #5a6acf;
    text-decoration: none;
    transition: background 0.2s;
}

.drawer-user-badge:hover {
    background: rgba(102, 126, 234, 0.2);
    text-decoration: none;
    color: #5a6acf;
}

.drawer-user-badge .hsw-icon {
    font-size: 0.9rem;
}

.drawer-login-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 25px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s, transform 0.15s;
}

.drawer-login-btn:hover {
    opacity: 0.9;
    color: #fff;
    text-decoration: none;
}

.drawer-login-btn:active {
    transform: scale(0.97);
}

/* ---- Tools Grid ---- */
.drawer-tools-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 0 16px;
}

.drawer-tool-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 6px 12px;
    background: #f8f9fc;
    border-radius: 14px;
    border: 1px solid #eef0f5;
    text-decoration: none;
    color: #333;
    min-height: 90px;
    transition: background 0.15s, transform 0.15s;
}

.drawer-tool-card:hover {
    background: #eef1f8;
    text-decoration: none;
    color: #333;
}

.drawer-tool-card:active {
    transform: scale(0.96);
}

.drawer-tool-img {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
}

.drawer-tool-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.drawer-tool-emoji {
    font-size: 28px;
    line-height: 1;
}

.drawer-tool-name {
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.drawer-tool-card-all {
    background: linear-gradient(135deg, #f0f0ff 0%, #e8e0f8 100%);
    border-color: #d8d0e8;
}

.drawer-tool-card-all:hover {
    background: linear-gradient(135deg, #e8e8ff 0%, #e0d8f8 100%);
}

.drawer-tool-emoji-all {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 24px;
    font-weight: 300;
    line-height: 1;
}

/* ---- Widgets Section ---- */
.drawer-widgets-section {
    margin: 0 16px 16px;
    background: #f8f9fc;
    border-radius: 12px;
    border: 1px solid #eef0f5;
    overflow: hidden;
}

.drawer-widget-row {
    border-bottom: 1px solid #eef0f5;
}

.drawer-widget-row:last-child {
    border-bottom: none;
}

.drawer-widget-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    color: #333;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: background 0.15s;
}

.drawer-widget-link:hover {
    background: #eef1f8;
    text-decoration: none;
    color: #333;
}

/* ---- Content Grid ---- */
.drawer-content-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 0 16px;
}

.drawer-content-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 14px;
    background: #f8f9fc;
    border-radius: 10px;
    border: 1px solid #eef0f5;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s;
}

.drawer-content-link:hover {
    background: #eef1f8;
    text-decoration: none;
    color: #333;
}

/* ---- Utilities Grid ---- */
.drawer-utils-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 16px 0;
}

.drawer-util-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    background: #f0f2f5;
    border-radius: 20px;
    color: #555;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: background 0.15s;
}

.drawer-util-link:hover {
    background: #e4e6ea;
    text-decoration: none;
    color: #333;
}

.drawer-logout-btn {
    color: #dc3545;
    background: #fef0f0;
}

.drawer-logout-btn:hover {
    background: #fde0e0;
    color: #c82333;
}

/* ---- Responsive Grid ---- */
@media (max-width: 359px) {
    .drawer-tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 414px) {
    .drawer-tools-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .drawer-content-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Animação do hamburger */
.hamburger-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.hamburger-btn.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* ==================== DESKTOP: ocultar drawer e overlay (previne flash) ==================== */
@media (min-width: 769px) {
    .mobile-drawer,
    .mobile-drawer-overlay {
        display: none !important;
    }
}

/* ==================== WCAG TOUCH TARGETS (44x44px minimum) ==================== */
.btn-favorite-compact,
.btn-share-compact {
    min-width: 44px;
    min-height: 44px;
}

.meta-item {
    min-height: 44px;
    padding: 8px 12px;
}

/* ==================== SAFE AREAS (notch support) ==================== */
.mobile-header-fixed {
    padding-top: env(safe-area-inset-top, 0px);
}

body.mobile-page {
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
