/* ========================================
   SISTEMA DE RESPONSIVIDADE MODERNO
   FiveM Brasil - Versão 2024
   ======================================== */

/* ========================================
   VARIÁVEIS CSS PARA CONSISTÊNCIA
   ======================================== */
:root {
    /* Cores principais */
    --primary-color: #ffdd00;
    --primary-dark: #ffc107;
    --primary-darker: #ffb300;
    --background-dark: #1a1a1a;
    --background-darker: #0f0f0f;
    --surface-dark: #2a2a2a;
    --surface-darker: #1f1f1f;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-muted: #888888;
    --border-color: #3a3a3a;
    --border-accent: rgba(255, 221, 0, 0.2);

    /* Breakpoints */
    --mobile-small: 320px;
    --mobile: 480px;
    --tablet: 768px;
    --desktop-small: 1024px;
    --desktop: 1200px;
    --desktop-large: 1400px;
    --desktop-xl: 1920px;
    --desktop-4k: 2560px;

    /* Espaçamentos responsivos */
    --spacing-xs: clamp(0.25rem, 0.5vw, 0.5rem);
    --spacing-sm: clamp(0.5rem, 1vw, 1rem);
    --spacing-md: clamp(1rem, 2vw, 2rem);
    --spacing-lg: clamp(1.5rem, 3vw, 3rem);
    --spacing-xl: clamp(2rem, 4vw, 4rem);
    --spacing-xxl: clamp(3rem, 6vw, 6rem);

    /* Tipografia responsiva */
    --font-xs: clamp(0.75rem, 1.5vw, 0.875rem);
    --font-sm: clamp(0.875rem, 1.8vw, 1rem);
    --font-base: clamp(1rem, 2vw, 1.125rem);
    --font-lg: clamp(1.125rem, 2.5vw, 1.25rem);
    --font-xl: clamp(1.25rem, 3vw, 1.5rem);
    --font-2xl: clamp(1.5rem, 4vw, 2rem);
    --font-3xl: clamp(2rem, 5vw, 3rem);
    --font-4xl: clamp(2.5rem, 6vw, 4rem);

    /* Containers responsivos */
    --container-xs: 100%;
    --container-sm: 540px;
    --container-md: 720px;
    --container-lg: 960px;
    --container-xl: 1140px;
    --container-xxl: 1320px;
    --container-4k: 1600px;
}

/* ========================================
   RESET E BASE RESPONSIVA
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

/* Ajuste de font-size base para diferentes resoluções */
@media (max-width: 480px) {
    html {
        font-size: 14px;
    }
}

@media (min-width: 1920px) {
    html {
        font-size: 18px;
    }
}

@media (min-width: 2560px) {
    html {
        font-size: 20px;
    }
}

body {
    background: var(--background-dark);
    color: var(--text-primary);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* ========================================
   CONTAINERS RESPONSIVOS
   ======================================== */
.container-responsive {
    width: 100%;
    max-width: var(--container-xxl);
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

@media (max-width: 576px) {
    .container-responsive {
        max-width: var(--container-xs);
        padding: 0 var(--spacing-sm);
    }
}

@media (min-width: 576px) {
    .container-responsive {
        max-width: var(--container-sm);
    }
}

@media (min-width: 768px) {
    .container-responsive {
        max-width: var(--container-md);
    }
}

@media (min-width: 992px) {
    .container-responsive {
        max-width: var(--container-lg);
    }
}

@media (min-width: 1200px) {
    .container-responsive {
        max-width: var(--container-xl);
    }
}

@media (min-width: 1400px) {
    .container-responsive {
        max-width: var(--container-xxl);
    }
}

@media (min-width: 2560px) {
    .container-responsive {
        max-width: var(--container-4k);
    }
}

/* ========================================
   SISTEMA DE GRID RESPONSIVO
   ======================================== */
.grid-responsive {
    display: grid;
    gap: var(--spacing-md);
    width: 100%;
}

/* Grid de 1 coluna (mobile) */
.grid-1 {
    grid-template-columns: 1fr;
}

/* Grid de 2 colunas */
.grid-2 {
    grid-template-columns: 1fr;
}

@media (min-width: 768px) {
    .grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Grid de 3 colunas */
.grid-3 {
    grid-template-columns: 1fr;
}

@media (min-width: 768px) {
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Grid de 4 colunas */
.grid-4 {
    grid-template-columns: 1fr;
}

@media (min-width: 576px) {
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .grid-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Grid auto-fit responsivo */
.grid-auto {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

@media (max-width: 480px) {
    .grid-auto {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   FLEXBOX RESPONSIVO
   ======================================== */
.flex-responsive {
    display: flex;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.flex-center {
    justify-content: center;
    align-items: center;
}

.flex-between {
    justify-content: space-between;
    align-items: center;
}

.flex-column-mobile {
    flex-direction: row;
}

@media (max-width: 768px) {
    .flex-column-mobile {
        flex-direction: column;
    }
}

/* ========================================
   TIPOGRAFIA RESPONSIVA
   ======================================== */
.text-xs {
    font-size: var(--font-xs);
}

.text-sm {
    font-size: var(--font-sm);
}

.text-base {
    font-size: var(--font-base);
}

.text-lg {
    font-size: var(--font-lg);
}

.text-xl {
    font-size: var(--font-xl);
}

.text-2xl {
    font-size: var(--font-2xl);
}

.text-3xl {
    font-size: var(--font-3xl);
}

.text-4xl {
    font-size: var(--font-4xl);
}

/* Títulos responsivos */
.title-responsive {
    font-size: var(--font-3xl);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--spacing-md);
}

.subtitle-responsive {
    font-size: var(--font-xl);
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: var(--spacing-sm);
}

/* ========================================
   ESPAÇAMENTOS RESPONSIVOS
   ======================================== */
.spacing-xs {
    margin: var(--spacing-xs);
}

.spacing-sm {
    margin: var(--spacing-sm);
}

.spacing-md {
    margin: var(--spacing-md);
}

.spacing-lg {
    margin: var(--spacing-lg);
}

.spacing-xl {
    margin: var(--spacing-xl);
}

.spacing-xxl {
    margin: var(--spacing-xxl);
}

.padding-xs {
    padding: var(--spacing-xs);
}

.padding-sm {
    padding: var(--spacing-sm);
}

.padding-md {
    padding: var(--spacing-md);
}

.padding-lg {
    padding: var(--spacing-lg);
}

.padding-xl {
    padding: var(--spacing-xl);
}

.padding-xxl {
    padding: var(--spacing-xxl);
}

/* ========================================
   COMPONENTES RESPONSIVOS
   ======================================== */

/* Botões responsivos */
.btn-responsive {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-md);
    border: none;
    border-radius: 8px;
    font-size: var(--font-base);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 44px;
    /* Acessibilidade touch */
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--background-dark);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-darker));
    transform: translateY(-2px);
}

/* Cards responsivos */
.card-responsive {
    background: var(--surface-dark);
    border-radius: 12px;
    padding: var(--spacing-lg);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.card-responsive:hover {
    border-color: var(--border-accent);
    transform: translateY(-2px);
}

/* ========================================
   NAVEGAÇÃO RESPONSIVA
   ======================================== */
.navbar-responsive {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    padding: var(--spacing-sm) 0;
}

.navbar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: var(--container-xxl);
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

.navbar-brand img {
    height: clamp(30px, 5vw, 50px);
    width: auto;
}

.navbar-menu {
    display: flex;
    gap: var(--spacing-md);
    align-items: center;
}

.navbar-link {
    color: var(--text-primary);
    text-decoration: none;
    font-size: var(--font-base);
    font-weight: 500;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: 8px;
    transition: all 0.3s ease;
    min-height: 44px;
    display: flex;
    align-items: center;
}

.navbar-link:hover {
    color: var(--primary-color);
    background: rgba(255, 221, 0, 0.1);
}

/* Menu mobile */
.navbar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: var(--font-xl);
    cursor: pointer;
    padding: var(--spacing-xs);
    min-height: 44px;
    min-width: 44px;
}

@media (max-width: 768px) {
    .navbar-menu {
        position: fixed;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--surface-dark);
        flex-direction: column;
        padding: var(--spacing-lg);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        border-top: 1px solid var(--border-color);
    }

    .navbar-menu.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .navbar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .navbar-link {
        width: 100%;
        justify-content: center;
        padding: var(--spacing-sm);
    }
}

/* ========================================
   SIDEBAR RESPONSIVA
   ======================================== */
.sidebar-responsive {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    background: var(--surface-dark);
    padding: var(--spacing-lg) 0;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.main-content-responsive {
    margin-left: 280px;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

@media (max-width: 1024px) {
    .sidebar-responsive {
        transform: translateX(-100%);
    }

    .sidebar-responsive.active {
        transform: translateX(0);
    }

    .main-content-responsive {
        margin-left: 0;
    }
}

/* ========================================
   MODAIS RESPONSIVOS
   ======================================== */
.modal-responsive {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: var(--spacing-md);
}

.modal-content-responsive {
    background: var(--surface-dark);
    border-radius: 16px;
    padding: var(--spacing-xl);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

@media (max-width: 768px) {
    .modal-content-responsive {
        padding: var(--spacing-lg);
        margin: var(--spacing-sm);
        max-height: 95vh;
    }
}

/* ========================================
   FORMULÁRIOS RESPONSIVOS
   ======================================== */
.form-responsive {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.form-group-responsive {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.form-label-responsive {
    font-size: var(--font-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.form-input-responsive {
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--background-dark);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: var(--font-base);
    min-height: 44px;
    transition: border-color 0.3s ease;
}

.form-input-responsive:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* ========================================
   TABELAS RESPONSIVAS
   ======================================== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    margin: var(--spacing-md) 0;
}

.table-responsive table {
    width: 100%;
    min-width: 600px;
    border-collapse: collapse;
    background: var(--surface-dark);
    border-radius: 8px;
    overflow: hidden;
}

.table-responsive th,
.table-responsive td {
    padding: var(--spacing-sm) var(--spacing-md);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table-responsive th {
    background: var(--background-darker);
    font-weight: 600;
    color: var(--primary-color);
}

/* ========================================
   UTILITÁRIOS RESPONSIVOS
   ======================================== */

/* Visibilidade responsiva */
.hide-mobile {
    display: block;
}

.show-mobile {
    display: none;
}

@media (max-width: 768px) {
    .hide-mobile {
        display: none;
    }

    .show-mobile {
        display: block;
    }
}

.hide-tablet {
    display: block;
}

.show-tablet {
    display: none;
}

@media (max-width: 1024px) {
    .hide-tablet {
        display: none;
    }

    .show-tablet {
        display: block;
    }
}

.hide-desktop {
    display: block;
}

.show-desktop {
    display: none;
}

@media (min-width: 1025px) {
    .hide-desktop {
        display: none;
    }

    .show-desktop {
        display: block;
    }
}

/* Alinhamento responsivo */
.text-center-mobile {
    text-align: left;
}

@media (max-width: 768px) {
    .text-center-mobile {
        text-align: center;
    }
}

/* Larguras responsivas */
.w-full {
    width: 100%;
}

.w-auto {
    width: auto;
}

.w-mobile-full {
    width: auto;
}

@media (max-width: 768px) {
    .w-mobile-full {
        width: 100%;
    }
}

/* ========================================
   ANIMAÇÕES RESPONSIVAS
   ======================================== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========================================
   SCROLL RESPONSIVO
   ======================================== */
.scroll-container {
    overflow-y: auto;
    max-height: 70vh;
}

/* Scrollbar personalizada */
.scroll-container::-webkit-scrollbar {
    width: 8px;
}

.scroll-container::-webkit-scrollbar-track {
    background: var(--background-darker);
    border-radius: 4px;
}

.scroll-container::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary-color), var(--primary-dark));
    border-radius: 4px;
    transition: all 0.3s ease;
}

.scroll-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--primary-dark), var(--primary-darker));
}

/* ========================================
   PERFORMANCE E OTIMIZAÇÃO
   ======================================== */

/* Otimização de imagens */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Lazy loading para imagens */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s ease;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* Otimização de vídeos */
video {
    max-width: 100%;
    height: auto;
}

/* ========================================
   ACESSIBILIDADE
   ======================================== */

/* Foco visível */
*:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Botões acessíveis */
button,
[role="button"] {
    min-height: 44px;
    min-width: 44px;
}

/* Contraste melhorado */
@media (prefers-contrast: high) {
    :root {
        --text-primary: #ffffff;
        --text-secondary: #ffffff;
        --border-color: #ffffff;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {

    .navbar-responsive,
    .sidebar-responsive,
    .modal-responsive,
    .hide-print {
        display: none !important;
    }

    .main-content-responsive {
        margin-left: 0 !important;
    }

    * {
        background: white !important;
        color: black !important;
    }
}