/**
 * CrediDigital - Tema Binance (Negro/Amarillo)
 * Identidad Visual Unificada para todo el sistema
 */

/* ============================================
   VARIABLES CSS - PALETA BINANCE
   ============================================ */
:root {
    /* Colores Primarios - Binance */
    --binance-black: #181a20;
    --binance-black-light: #1e2329;
    --binance-black-lighter: #2b3139;
    --binance-yellow: #fcd535;
    --binance-yellow-hover: #fde06d;
    --binance-yellow-dark: #f0b90b;

    /* Colores de Estado */
    --binance-green: #0ecb81;
    --binance-green-hover: #0dcb81cc;
    --binance-red: #f6465d;
    --binance-red-hover: #f6465dcc;
    --binance-blue: #3b82f6;

    /* Colores de Texto */
    --text-primary: #eaecef;
    --text-secondary: #c8cdd5;
    --text-muted: #848e9c;
    --text-dark: #181a20;

    /* Bordes */
    --border-color: #2b3139;
    --border-hover: #474d57;

    /* Tipografía */
    --font-family: 'IBM Plex Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Z-Index */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-modal: 300;
    --z-toast: 400;
}

/* ============================================
   RESET Y BASE
   ============================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    font-family: var(--font-family);
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--binance-black);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   SCROLLBAR PERSONALIZADA
   ============================================ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--binance-black);
}

::-webkit-scrollbar-thumb {
    background: var(--binance-black-lighter);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* ============================================
   COMPONENTES BASE
   ============================================ */

/* Cards */
.card {
    background: var(--binance-black-light);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.card-highlight {
    background: var(--binance-black-light);
    border-radius: 16px;
    border: 1px solid var(--binance-yellow);
    box-shadow: 0 0 20px rgba(252, 213, 53, 0.1);
}

/* Botones */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--binance-yellow);
    color: var(--text-dark);
}

.btn-primary:hover:not(:disabled) {
    background: var(--binance-yellow-hover);
}

.btn-secondary {
    background: var(--binance-black-lighter);
    color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--border-hover);
}

.btn-success {
    background: var(--binance-green);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: var(--binance-green-hover);
}

.btn-danger {
    background: var(--binance-red);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: var(--binance-red-hover);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--binance-black-lighter);
    color: var(--text-primary);
}

.btn-outline:hover:not(:disabled) {
    border-color: var(--binance-yellow);
    color: var(--binance-yellow);
}

/* Inputs */
.input-field {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    color: var(--text-primary);
    background: var(--binance-black);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.input-field:hover {
    border-color: var(--border-hover);
}

.input-field:focus {
    outline: none;
    border-color: var(--binance-yellow);
    box-shadow: 0 0 0 2px rgba(252, 213, 53, 0.1);
}

.input-field:disabled {
    background: var(--binance-black-lighter);
    cursor: not-allowed;
    opacity: 0.7;
}

.input-field::placeholder {
    color: var(--text-muted);
}

/* Select */
select.input-field {
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23848e9c' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-yellow {
    background: rgba(252, 213, 53, 0.2);
    color: var(--binance-yellow);
}

.badge-green {
    background: rgba(14, 203, 129, 0.2);
    color: var(--binance-green);
}

.badge-red {
    background: rgba(246, 70, 93, 0.2);
    color: var(--binance-red);
}

.badge-gray {
    background: var(--binance-black-lighter);
    color: var(--text-secondary);
}

/* ============================================
   NAVBAR
   ============================================ */
.navbar {
    background: var(--binance-black);
    padding: 0 1rem;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
}

.navbar-brand {
    color: var(--binance-yellow);
    font-weight: 700;
    font-size: 1.25rem;
    text-decoration: none;
    letter-spacing: -0.5px;
}

.navbar-brand span {
    color: var(--text-primary);
}

.navbar-nav {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.navbar-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s;
}

.navbar-nav a:hover,
.navbar-nav a.active {
    color: var(--text-primary);
}

/* ============================================
   BOTTOM NAVIGATION (Mobile)
   ============================================ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--binance-black);
    border-top: 1px solid var(--border-color);
    padding: 8px 0;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    z-index: var(--z-sticky);
}

.bottom-nav-inner {
    display: flex;
    justify-content: space-around;
    align-items: center;
    max-width: 480px;
    margin: 0 auto;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s;
    padding: 4px 8px;
}

.nav-item:hover,
.nav-item.active {
    color: var(--binance-yellow);
}

.nav-item i {
    width: 20px;
    height: 20px;
}

/* ============================================
   FLOATING ACTION BUTTON
   ============================================ */
.fab {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--binance-yellow);
    color: var(--text-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(252, 213, 53, 0.4);
    z-index: 40;
    text-decoration: none;
    transition: all 0.3s ease;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(252, 213, 53, 0.5);
}

/* ============================================
   ESTADÍSTICAS (Stats Cards)
   ============================================ */
.stat-card {
    background: var(--binance-black-light);
    border-radius: 12px;
    padding: 1.25rem;
}

.stat-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-value.positive {
    color: var(--binance-green);
}

.stat-value.negative {
    color: var(--binance-red);
}

.stat-value.highlight {
    color: var(--binance-yellow);
}

.stat-subtitle {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* ============================================
   TABLAS
   ============================================ */
.table-container {
    background: var(--binance-black-light);
    border-radius: 12px;
    overflow: hidden;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    background: var(--binance-black-lighter);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    text-align: left;
    padding: 0.75rem 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.table tr:hover td {
    background: var(--binance-black);
}

.table tr:last-child td {
    border-bottom: none;
}

/* ============================================
   MODALES
   ============================================ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: var(--z-modal);
}

.modal {
    background: var(--binance-black-light);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    max-width: 480px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: var(--binance-black-lighter);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
}

.modal-title {
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* ============================================
   TOASTS / NOTIFICACIONES
   ============================================ */
.toast-container {
    position: fixed;
    top: 80px;
    right: 1rem;
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    min-width: 250px;
    max-width: 400px;
    animation: slideIn 0.3s ease;
}

.toast-success {
    background: var(--binance-green);
    color: white;
}

.toast-error {
    background: var(--binance-red);
    color: white;
}

.toast-warning {
    background: var(--binance-yellow);
    color: var(--text-dark);
}

.toast-info {
    background: var(--binance-blue);
    color: white;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ============================================
   PROGRESS BARS
   ============================================ */
.progress-bar {
    height: 6px;
    border-radius: 3px;
    background: var(--binance-black-lighter);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--binance-yellow);
    transition: width 0.3s ease;
}

.progress-fill.green {
    background: var(--binance-green);
}

.progress-fill.red {
    background: var(--binance-red);
}

/* ============================================
   AVATARES
   ============================================ */
.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.avatar-sm {
    width: 36px;
    height: 36px;
}

.avatar-lg {
    width: 64px;
    height: 64px;
}

.avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--binance-black-lighter);
    color: var(--binance-yellow);
    font-weight: 700;
    font-size: 1rem;
}

/* ============================================
   STAR RATING
   ============================================ */
.star-filled {
    color: var(--binance-yellow);
    fill: currentColor;
}

.star-empty {
    color: var(--border-hover);
}

/* ============================================
   SKELETON LOADING
   ============================================ */
.skeleton {
    background: linear-gradient(90deg,
            var(--binance-black-lighter) 25%,
            var(--border-hover) 50%,
            var(--binance-black-lighter) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ============================================
   ANIMACIONES
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.animate-fadeIn {
    animation: fadeIn 0.3s ease forwards;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-slideUp {
    animation: slideUp 0.3s ease forwards;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 0.8s linear infinite;
}

/* ============================================
   UTILITIES
   ============================================ */

/* Ocultar scrollbar */
.hide-scrollbar::-webkit-scrollbar {
    display: none;
}

.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Hide number input spinners */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield;
}

/* Safe area padding */
.pb-safe {
    padding-bottom: env(safe-area-inset-bottom, 20px);
}

.pt-safe {
    padding-top: env(safe-area-inset-top, 0);
}

/* Text colors */
.text-yellow {
    color: var(--binance-yellow);
}

.text-green {
    color: var(--binance-green);
}

.text-red {
    color: var(--binance-red);
}

.text-muted {
    color: var(--text-secondary);
}

.text-primary-light {
    color: var(--text-primary);
}

/* Background colors */
.bg-black {
    background: var(--binance-black);
}

.bg-black-light {
    background: var(--binance-black-light);
}

.bg-black-lighter {
    background: var(--binance-black-lighter);
}

.bg-yellow {
    background: var(--binance-yellow);
}

/* Border colors */
.border-yellow {
    border-color: var(--binance-yellow);
}

.border-green {
    border-color: var(--binance-green);
}

.border-muted {
    border-color: var(--border-color);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .navbar-nav {
        display: none;
    }

    .stat-value {
        font-size: 1.5rem;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {

    .no-print,
    .bottom-nav,
    .fab,
    .navbar {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ============================================
   TAILWIND OVERRIDES - TEMA OSCURO
   Corrección de colores que no contrastan bien
   ============================================ */

/* Override text-slate-* clases para mejor contraste en tema oscuro */
.text-slate-600 {
    --tw-text-opacity: 1;
    color: rgb(200 205 213 / var(--tw-text-opacity, 1)) !important;
}

.text-slate-500 {
    --tw-text-opacity: 1;
    color: rgb(180 185 195 / var(--tw-text-opacity, 1)) !important;
}

.text-slate-700 {
    --tw-text-opacity: 1;
    color: rgb(200 205 213 / var(--tw-text-opacity, 1)) !important;
}

/* Override para color inline #848e9c */
[style*="#848e9c"] {
    color: #c8cdd5 !important;
}

/* Clases específicas con text-[#848e9c] */
.text-\[\#848e9c\] {
    color: #c8cdd5 !important;
}

/* Background slate oscuros */
.bg-slate-100 {
    background-color: var(--binance-black-lighter) !important;
}

.bg-slate-50 {
    background-color: var(--binance-black-light) !important;
}