/* styles.css - Estilos de la aplicación */

/* Reset y base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, sans-serif;
    background: #121212;
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: #1A1A1B;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
    padding-top: env(safe-area-inset-top);
}

.header-content {
    max-width: 896px;
    margin: 0 auto;
    padding: 16px;
}

h1 {
    font-size: 20px;
    font-weight: 700;
    color: #f1f5f9;
    margin-bottom: 12px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
}

.tab {
    flex: 1;
    min-width: 65px;
    padding: 10px 6px;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.tab:active {
    transform: scale(0.98);
}

.tab-inactive {
    background: #2a2a2b;
    color: #cbd5e1;
}

.tab-active {
    background: #F99F35;
    color: #fff;
}

/* Container principal */
.container {
    flex: 1;
    overflow-y: auto;
    max-width: 896px;
    margin: 0 auto;
    width: 100%;
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
}

/* Sheets */
.sheet-content {
    display: flex;
    flex-direction: column;
}

.sheet-content.hidden {
    display: none !important;
}

/* Cards */
.card {
    background: #1A1A1B;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    padding: 12px;
    margin-bottom: 24px;
    border: 1px solid #2a2a2b;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #f1f5f9;
}

/* Formularios */
.form-group {
    margin-bottom: 12px;
}

label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #cbd5e1;
    margin-bottom: 3px;
}

input,
select {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #2a2a2b;
    border-radius: 8px;
    font-size: 15px;
    background: #121212;
    color: #e2e8f0;
}

/* FIX: Inputs de fecha en móvil */
input[type="date"],
input[type="week"],
input[type="month"] {
    font-family: -apple-system, sans-serif;
    min-width: 0;
    width: 100%;
    height: 38px;
    line-height: normal;
    padding: 7px 10px;
    font-size: 14px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Icono del calendario más pequeño en móvil */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="week"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
    width: 18px;
    height: 18px;
    padding: 0;
    margin: 0;
}

/* Firefox date input */
input[type="date"]::-moz-calendar-picker-indicator,
input[type="week"]::-moz-calendar-picker-indicator,
input[type="month"]::-moz-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
    width: 18px;
    height: 18px;
}

/* Ajuste específico para móviles pequeños */
@media screen and (max-width: 480px) {
    input[type="date"],
    input[type="week"],
    input[type="month"] {
        font-size: 13px;
        padding: 6px 8px;
        height: 36px;
    }
    
    input[type="date"]::-webkit-calendar-picker-indicator,
    input[type="week"]::-webkit-calendar-picker-indicator,
    input[type="month"]::-webkit-calendar-picker-indicator {
        width: 16px;
        height: 16px;
    }
}

input:focus,
select:focus {
    outline: none;
    border-color: #F99F35;
    box-shadow: 0 0 0 3px rgba(249, 159, 53, 0.2);
}

/* Grid */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Botones */
.btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: #F99F35;
    color: #fff;
}

.btn-success {
    background: #F99F35;
    color: #fff;
}

.btn-result {
    padding: 9px;
    font-size: 13px;
    font-weight: 600;
    border: 2px solid transparent;
    background: #2a2a2b;
    color: #cbd5e1;
}

.btn-result.selected-w {
    background: #14532d;
    border-color: #22c55e;
    color: #22c55e;
}

.btn-result.selected-l {
    background: #450a0a;
    border-color: #ef4444;
    color: #ef4444;
}

.btn-result.selected-v {
    background: #1A1A1B;
    border-color: #64748b;
    color: #64748b;
}

/* Items de apuestas */
.bet-item {
    background: #1A1A1B;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid #2a2a2b;
}

.bet-w {
    background: #14532d;
    border-left: 4px solid #22c55e;
}

.bet-l {
    background: #450a0a;
    border-left: 4px solid #ef4444;
}

.bet-v {
    background: #262c36;
    border-left: 4px solid #64748b;
}

.bet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    position: relative;
}

.bet-date {
    font-size: 13px;
    color: #94a3b8;
}

.bet-sport {
    font-weight: 600;
    color: #f1f5f9;
}

.bet-tag {
    display: inline-block;
    color: #fff;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 6px;
}

.bet-tag.pre-match {
    background: #64748b;
}

.bet-tag.live {
    background: #ef4444;
}

.bet-tag.hedge {
    background: #3b82f6;
}

.bet-tag.cashout {
    background: #b09300;
}

/* Menú de apuesta */
.bet-menu-btn {
    color: #94a3b8;
    font-size: 25px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
}

.bet-menu {
    position: absolute;
    top: 30px;
    right: 0;
    background: #121212;
    border: 1px solid #2a2a2b;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 10;
    display: none;
}

.bet-menu.show {
    display: block;
}

.bet-menu-item {
    color: #cbd5e1;
    font-size: 14px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 12px 20px;
    font-weight: 500;
    width: 100%;
    text-align: left;
    display: block;
    border-bottom: 1px solid #2a2a2b;
}

.bet-menu-item:last-child {
    border-bottom: none;
}

.bet-menu-item.delete {
    color: #ef4444;
}

.bet-menu-item:active {
    background: #1A1A1B;
}

.bet-market {
    color: #cbd5e1;
    margin-bottom: 4px;
}

.bet-details-text {
    color: #94a3b8;
    font-size: 13px;
    margin-bottom: 12px;
    font-style: italic;
}

.bet-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.bet-details {
    display: flex;
    gap: 16px;
    color: #94a3b8;
    flex-wrap: wrap;
}

.bet-profit {
    font-size: 18px;
    font-weight: 700;
}

.profit-positive {
    color: #22c55e;
}

.profit-negative {
    color: #ef4444;
}

.profit-neutral {
    color: #94a3b8;
}

/* Estadísticas */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.stat-label {
    font-size: 13px;
    color: #94a3b8;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #f1f5f9;
}

/* Estado vacío */
.empty-state {
    text-align: center;
    padding: 48px 16px;
    color: #64748b;
}

/* Toast notifications */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    background: #1A1A1B;
    color: #f1f5f9;
    padding: 10px 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    margin-top: 10px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s, transform 0.3s;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: #1A1A1B;
    border-radius: 12px;
    padding: 20px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid #2a2a2b;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #f1f5f9;
}

.modal-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

/* Sync Indicator */
.sync-indicator {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.sync-local {
    background: #2a2a2b;
    color: #cbd5e1;
}

.sync-syncing {
    background: #1e40af;
    color: #93c5fd;
    animation: pulse 1.5s ease-in-out infinite;
}

.sync-success {
    background: #14532d;
    color: #22c55e;
}

.sync-error {
    background: #450a0a;
    color: #ef4444;
}

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

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #2a2a2b;
    transition: 0.3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #F99F35;
}

input:checked + .slider:before {
    transform: translateX(24px);
}