/* CSS Global - Curso de Damas */

/* ============= RESET E BASE ============= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden;
    max-width: 100vw;
    position: relative;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #000000, #2a2a2a);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

/* ============= HEADER PADRÃO ============= */
.header {
    background: linear-gradient(135deg, #2c3e50, #3498db);
    color: white;
    padding: 15px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.logo {
    font-size: 20px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 14px;
    flex-wrap: wrap;
}

.user-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}

.time-remaining {
    background: #e74c3c;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}

.vip-button {
    background: #f39c12;
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 12px;
    font-weight: bold;
    transition: all 0.3s;
}

.vip-button:hover {
    background: #e67e22;
    transform: translateY(-1px);
}

.nav-links {
    display: flex;
    gap: 10px;
    align-items: center;
}

.nav-links a {
    color: white;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 5px;
    transition: background 0.3s;
    font-size: 13px;
}

.nav-links a:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ============= CONTAINERS PRINCIPAIS ============= */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.main-content {
    padding: 80px 20px 40px;
    max-width: 1400px;
    margin: 0 auto;
}

/* ============= TÍTULOS DE PÁGINA ============= */
.page-title {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.page-title h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.page-title p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* ============= CARDS E SEÇÕES ============= */
.card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    overflow: hidden;
    transition: all 0.3s;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 60px rgba(0,0,0,0.2);
}

.card-header {
    padding: 20px;
    border-bottom: 1px solid #ecf0f1;
    background: #f8f9fa;
}

.card-body {
    padding: 25px;
}

.section {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    margin-bottom: 30px;
    overflow: hidden;
}

.section-header {
    padding: 25px;
    border-bottom: 1px solid #ecf0f1;
    background: #f8f9fa;
}

.section-header h2 {
    color: #2c3e50;
    font-size: 24px;
    margin-bottom: 5px;
}

.section-header p {
    color: #7f8c8d;
    font-size: 14px;
}

.section-body {
    padding: 25px;
}

/* ============= GRIDS ============= */
.grid {
    display: grid;
    gap: 20px;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* ============= ESTUDOS/ITEMS ============= */
.studies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.study-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    position: relative;
    overflow: hidden;
}

.study-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.study-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.study-title {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 15px;
    line-height: 1.4;
}

.study-description {
    color: #7f8c8d;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.study-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 12px;
    color: #95a5a6;
}

.study-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px 0;
    font-size: 13px;
    color: #7f8c8d;
}

/* ============= PROGRESS BARS ============= */
.progress-bar {
    background: #ecf0f1;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s;
}

.progress-text {
    text-align: center;
    font-size: 14px;
    color: #7f8c8d;
}

/* ============= BOTÕES ============= */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
    line-height: 1;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #229954 0%, #27ae60 100%);
}

.btn-warning {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: white;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #e67e22 0%, #d68910 100%);
}

.btn-danger {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ============= MENSAGENS E AVISOS ============= */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    font-weight: 500;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border-color: #ffeaa7;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border-color: #bee5eb;
}

.time-warning {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: white;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 30px;
}

.time-expired {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

/* ============= ESTADOS VAZIOS ============= */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #7f8c8d;
}

.empty-state h2,
.empty-state h3 {
    color: #7f8c8d;
    margin-bottom: 15px;
}

.empty-state p {
    color: #95a5a6;
    font-size: 16px;
}

/* ============= TABELAS ============= */
table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

th, td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #ecf0f1;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
}

tr:hover {
    background: #f8f9fa;
}

/* ============= BADGES E ETIQUETAS ============= */
.badge {
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
}

.badge-primary {
    background: #3498db;
    color: white;
}

.badge-success {
    background: #27ae60;
    color: white;
}

.badge-warning {
    background: #f39c12;
    color: white;
}

.badge-danger {
    background: #e74c3c;
    color: white;
}

.badge-light {
    background: #ecf0f1;
    color: #2c3e50;
}

.status-active {
    background: #d4edda;
    color: #155724;
}

.status-inactive {
    background: #f8d7da;
    color: #721c24;
}

/* ============= FORMULÁRIOS ============= */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #ecf0f1;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* ============= RESPONSIVIDADE ============= */

/* Tablets */
@media (max-width: 1024px) {
    .main-content {
        padding: 70px 15px 30px;
    }

    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .logo {
        font-size: 18px;
    }

    .user-info {
        width: 100%;
        justify-content: space-between;
        font-size: 13px;
    }

    .studies-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 20px;
    }

    .page-title h1 {
        font-size: 2rem;
    }
}

/* Celulares */
@media (max-width: 768px) {
    .main-content {
        padding: 120px 10px 20px;
    }

    .header {
        padding: 10px 0;
    }

    .header-content {
        padding: 0 15px;
    }

    .logo {
        font-size: 16px;
    }

    .nav-links {
        flex-wrap: wrap;
        gap: 8px;
    }

    .nav-links a {
        font-size: 11px;
        padding: 4px 8px;
    }

    .studies-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .study-card {
        padding: 20px;
    }

    .page-title h1 {
        font-size: 1.8rem;
    }

    .page-title p {
        font-size: 1rem;
    }

    .btn {
        padding: 10px 16px;
        font-size: 13px;
    }

    .card-body,
    .section-body {
        padding: 20px;
    }

    .grid {
        gap: 15px;
    }

    th, td {
        padding: 10px;
        font-size: 14px;
    }
}

/* Telas muito pequenas */
@media (max-width: 480px) {
    .main-content {
        padding: 100px 5px 15px;
    }

    .study-card {
        padding: 15px;
    }

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

    .btn {
        padding: 8px 12px;
        font-size: 12px;
    }
}

/* Landscape em dispositivos móveis */
@media (max-width: 768px) and (orientation: landscape) {
    .main-content {
        padding: 70px 10px 15px;
    }

    .header {
        padding: 8px 0;
    }
}

/* ============= UTILITÁRIOS ============= */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-grid { display: grid; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }
.mb-4 { margin-bottom: 40px; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }
.mt-4 { margin-top: 40px; }

.p-0 { padding: 0; }
.p-1 { padding: 10px; }
.p-2 { padding: 20px; }
.p-3 { padding: 30px; }

.w-100 { width: 100%; }
.h-100 { height: 100%; }

.text-primary { color: #3498db; }
.text-success { color: #27ae60; }
.text-warning { color: #f39c12; }
.text-danger { color: #e74c3c; }
.text-muted { color: #7f8c8d; }

/* ============= ANIMAÇÕES ============= */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

.slide-down {
    animation: slideDown 0.3s ease-out;
}

.pulse {
    animation: pulse 1s infinite;
}

/* ============= SCROLLBAR PERSONALIZADA ============= */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* ============= AVATAR PADRÃO (CIRCULAR) ============= */
.user-avatar,
.player-avatar,
.avatar {
    border-radius: 50% !important;
    object-fit: cover;
    flex-shrink: 0;
}

/* Tamanhos de avatar */
.avatar-small {
    width: 32px;
    height: 32px;
}

.avatar-medium {
    width: 60px;
    height: 60px;
}

.avatar-large {
    width: 120px;
    height: 120px;
}

/* Avatar com inicial (quando não há imagem) */
.avatar-initial {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

/* ============= CORREÇÕES DE ALINHAMENTO MOBILE ============= */

/* Prevenir scroll horizontal em todos os dispositivos */
html {
    scroll-behavior: smooth;
}

html, body {
    width: 100%;
    overflow-x: hidden !important;
}

/* Container principal sempre dentro dos limites */
.container,
.main-container,
.main-content {
    max-width: 100% !important;
    overflow-x: hidden !important;
}

/* Elementos com position fixed não devem sair da tela */
[style*="position: fixed"],
.fixed-element {
    max-width: 100vw !important;
}

/* Correções específicas para mobile */
@media (max-width: 768px) {
    /* Remover larguras mínimas problemáticas */
    * {
        min-width: 0 !important;
    }

    /* Elementos que devem ser fluidos em mobile */
    img,
    iframe,
    video,
    embed,
    object {
        max-width: 100% !important;
        height: auto !important;
    }

    /* Containers e divs não devem ter largura fixa */
    div,
    section,
    article,
    aside {
        max-width: 100% !important;
    }

    /* Tabelas responsivas */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Padding reduzido para aproveitar espaço */
    .container,
    .main-container {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    /* Botões e forms devem ser 100% em mobile */
    .btn,
    button,
    input[type="submit"],
    input[type="button"] {
        max-width: 100%;
    }

    /* Grid sempre em coluna única em mobile */
    .grid,
    .studies-grid {
        grid-template-columns: 1fr !important;
    }

    /* Flex containers em coluna */
    .flex-container {
        flex-direction: column !important;
    }

    /* Menu e navegação */
    .nav-links,
    .menu {
        flex-wrap: wrap !important;
        justify-content: center !important;
    }

    /* Cards e seções */
    .card,
    .section,
    .study-card {
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* Telas muito pequenas (iPhone SE, etc) */
@media (max-width: 375px) {
    /* Padding ainda mais reduzido */
    .container,
    .main-container,
    .main-content {
        padding-left: 5px !important;
        padding-right: 5px !important;
    }

    /* Fonte menor para caber melhor */
    body {
        font-size: 14px;
    }

    h1 { font-size: 1.5rem !important; }
    h2 { font-size: 1.3rem !important; }
    h3 { font-size: 1.1rem !important; }

    /* Botões menores */
    .btn {
        padding: 8px 12px !important;
        font-size: 12px !important;
    }
}

/* Landscape em dispositivos pequenos */
@media (max-height: 500px) and (orientation: landscape) {
    /* Header mais compacto */
    .header {
        padding: 5px 0 !important;
    }

    /* Conteúdo principal com menos padding vertical */
    .main-content {
        padding-top: 60px !important;
        padding-bottom: 10px !important;
    }
}