/* ============================================
   ClubFormare - CSS Mobile-First
   ============================================ */

/* === RESET & BASE === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #1a1a2e;
    --primary-light: #16213e;
    --accent: #e94560;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
    --info: #3498db;
    --dark: #2c3e50;
    --gray: #95a5a6;
    --gray-light: #ecf0f1;
    --gray-lighter: #f8f9fa;
    --white: #ffffff;
    --text: #333333;
    --text-muted: #7f8c8d;
    --border: #ddd;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
    --radius: 8px;
    --radius-sm: 4px;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    color: var(--text);
    background: var(--gray-lighter);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
}

/* === CONTAINER === */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

/* === NAVBAR === */
.navbar {
    background: var(--primary);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.navbar-admin {
    background: var(--dark);
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    min-height: 56px;
}

.nav-brand {
    color: var(--white) !important;
    font-size: 1.25rem;
    font-weight: 700;
    text-decoration: none !important;
    letter-spacing: 0.5px;
}

.nav-toggle {
    display: block;
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
}

.nav-menu {
    display: none;
    list-style: none;
    width: 100%;
    padding: 8px 0;
}

.nav-menu.active {
    display: block;
}

.nav-link {
    display: block;
    color: rgba(255,255,255,0.85) !important;
    padding: 10px 0;
    text-decoration: none !important;
    font-size: 0.95rem;
}

.nav-link:hover {
    color: var(--white) !important;
}

.nav-link-logout {
    color: var(--accent) !important;
}

/* === MAIN CONTENT === */
.main-content {
    padding: 24px 0;
    min-height: calc(100vh - 56px - 60px);
}

/* === AUTH PAGES === */
.auth-body {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 16px;
}

.admin-auth {
    background: linear-gradient(135deg, var(--dark) 0%, #1a252f 100%);
}

.auth-container {
    width: 100%;
    max-width: 440px;
}

.auth-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 32px 24px;
    box-shadow: var(--shadow-lg);
}

.auth-card-wide {
    max-width: 560px;
}

.auth-header {
    text-align: center;
    margin-bottom: 24px;
}

.auth-logo {
    font-size: 1.75rem;
    color: var(--primary);
    font-weight: 800;
    letter-spacing: 1px;
}

.auth-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 4px;
}

.auth-form {
    margin-bottom: 16px;
}

.auth-links {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    padding-top: 16px;
    border-top: 1px solid var(--gray-light);
}

/* === ALERTS === */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    position: relative;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.alert-success { background: #d4edda; color: #155724; border-left: 4px solid var(--success); }
.alert-error { background: #f8d7da; color: #721c24; border-left: 4px solid var(--danger); }
.alert-warning { background: #fff3cd; color: #856404; border-left: 4px solid var(--warning); }
.alert-info { background: #d1ecf1; color: #0c5460; border-left: 4px solid var(--info); }

.alert a {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
}

.alert-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
    padding: 0 4px;
    margin-left: 8px;
    flex-shrink: 0;
}

/* === FORMS === */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--dark);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: var(--font);
    transition: border-color 0.2s;
    background: var(--white);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.1);
}

.form-group input:disabled {
    background: var(--gray-light);
    cursor: not-allowed;
}

.form-group input[type="file"] {
    padding: 8px;
}

.form-help {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.form-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-inline {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    font-weight: 400 !important;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
}

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    text-decoration: none !important;
    transition: all 0.2s;
    line-height: 1.4;
}

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

.btn-primary:hover {
    background: #d63651;
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-warning {
    background: var(--warning);
    color: var(--white);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-dark {
    background: var(--dark);
    color: var(--white);
}

.btn-outline {
    background: transparent;
    border-color: var(--border);
    color: var(--text);
}

.btn-outline:hover {
    background: var(--gray-light);
}

.btn-disabled {
    background: var(--gray);
    color: var(--white);
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

/* === CARDS === */
.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--gray-light);
}

.cards-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.card-stat {
    text-align: center;
    padding: 24px 16px;
}

.card-stat-number {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.2;
}

.card-stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.card-stat-warning .card-stat-number { color: var(--warning); }
.card-stat-info .card-stat-number { color: var(--info); }
.card-stat-danger .card-stat-number { color: var(--danger); }

/* === SALDO CARD === */
.saldo-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: var(--white);
    border-radius: var(--radius);
    padding: 32px 24px;
    text-align: center;
    margin-bottom: 24px;
    box-shadow: var(--shadow-lg);
}

.saldo-card-compact {
    padding: 20px;
    margin-bottom: 12px;
}

.saldo-info {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.saldo-label {
    font-size: 0.9rem;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.saldo-valor {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.2;
    margin: 4px 0;
}

.nivel-badge {
    display: inline-block;
    padding: 4px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 12px;
}

.nivel-prime {
    background: #cd7f32;
    color: var(--white);
}

.nivel-elite {
    background: linear-gradient(135deg, #c0c0c0, #e8e8e8);
    color: var(--dark);
}

.nivel-signature {
    background: linear-gradient(135deg, #ffd700, #ffec80);
    color: var(--dark);
}

/* === PAGE HEADER === */
.page-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 1.5rem;
    color: var(--primary);
}

/* === SECTIONS === */
.section {
    margin-top: 32px;
}

.section-title {
    font-size: 1.2rem;
    color: var(--primary);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--gray-light);
}

/* === TABLES === */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 16px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.table thead {
    background: var(--gray-lighter);
}

.table th {
    padding: 12px 16px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    text-align: left;
    white-space: nowrap;
}

.table td {
    padding: 12px 16px;
    font-size: 0.9rem;
    border-top: 1px solid var(--gray-light);
    vertical-align: middle;
}

.table tbody tr:hover {
    background: var(--gray-lighter);
}

.table-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

/* === BADGES === */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success { background: #d4edda; color: #155724; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-danger { background: #f8d7da; color: #721c24; }
.badge-info { background: #d1ecf1; color: #0c5460; }
.badge-primary { background: #cce5ff; color: #004085; }
.badge-dark { background: #d6d8db; color: #1b1e21; }

/* === PREMIOS GRID === */
.premios-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.premio-card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.premio-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.premio-imagem {
    height: 200px;
    overflow: hidden;
    background: var(--gray-light);
}

.premio-imagem img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.premio-sem-imagem {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--gray);
    font-size: 0.9rem;
}

.premio-info {
    padding: 16px;
}

.premio-nome {
    font-size: 1.1rem;
    color: var(--primary);
    margin-bottom: 4px;
}

.premio-descricao {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.premio-pontos {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--accent);
    margin-bottom: 4px;
}

.premio-estoque {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* === RESGATE ITEM === */
.resgate-premio {
    display: flex;
    align-items: center;
    gap: 8px;
}

.resgate-thumb {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.resgate-form-row {
    background: var(--gray-lighter);
}

/* === QUICK ACTIONS === */
.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
}

/* === FILTERS === */
.filters {
    margin-bottom: 24px;
}

.filter-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* === EMPTY STATE === */
.empty-state {
    text-align: center;
    padding: 48px 16px;
    color: var(--text-muted);
}

.empty-state .btn {
    margin-top: 16px;
}

/* === UTILITIES === */
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-center { text-align: center; }
.mb-1 { margin-bottom: 16px; }

code {
    background: var(--gray-light);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.85em;
}

.preview-img {
    max-width: 200px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.current-image {
    margin-bottom: 8px;
}

.actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* === FOOTER === */
.footer {
    background: var(--white);
    border-top: 1px solid var(--gray-light);
    padding: 16px 0;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.footer-admin {
    background: var(--dark);
    color: rgba(255,255,255,0.5);
    border-top: none;
}

/* ============================================
   RESPONSIVE - TABLET (min-width: 600px)
   ============================================ */
@media (min-width: 600px) {
    .container {
        padding: 0 24px;
    }

    .form-row {
        flex-direction: row;
        gap: 16px;
    }

    .form-row .form-group {
        flex: 1;
    }

    .form-group-small {
        flex: 0 0 120px !important;
    }

    .form-group-grow {
        flex: 2 !important;
    }

    .form-inline {
        flex-direction: row;
        align-items: flex-end;
    }

    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .premios-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .quick-actions {
        flex-direction: row;
    }

    .filter-form {
        flex-direction: row;
        align-items: flex-end;
    }

    .page-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .auth-container {
        max-width: 440px;
    }

    .auth-card-wide {
        max-width: 560px;
    }
}

/* ============================================
   RESPONSIVE - DESKTOP (min-width: 900px)
   ============================================ */
@media (min-width: 900px) {
    .nav-toggle {
        display: none;
    }

    .nav-menu {
        display: flex !important;
        width: auto;
        padding: 0;
        gap: 4px;
    }

    .nav-link {
        padding: 16px 12px;
    }

    .cards-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .cards-grid-4 {
        grid-template-columns: repeat(4, 1fr);
    }

    .premios-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .saldo-valor {
        font-size: 3.5rem;
    }

    .page-header h1 {
        font-size: 1.75rem;
    }
}

/* ============================================
   RESPONSIVE - LARGE DESKTOP (min-width: 1200px)
   ============================================ */
@media (min-width: 1200px) {
    .premios-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
