/* JuanpiAMVs Theme - Saber x Bambietta Fusion */
:root {
    --primary-font: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    
    /* Palette from Images */
    --red-accent: #ef4444; /* Saber red */
    --red-dark: #dc2626;
    --cyan-accent: #00d4ff; /* Bambietta cyan */
    --cyan-bright: #22d3ee;
    --gold-accent: #f59e0b;
    --black-deep: #0a0a14;
    --black-card: #1a1a2e;
    
    /* Glass Effect - TACTICAL UPGRADE */
    --glass-bg-color: rgba(5, 5, 10, 0.50); /* Más transparente para ver mejor el fondo */
    --glass-bg-color-hover: rgba(20, 20, 30, 0.7);
    --glass-blur-intensity: 5px; /* Blur reducido para mayor nitidez */
    --glass-border-color: rgba(34, 211, 238, 0.4);
    --glass-border-radius: 4px; /* Bordes más rectos, estilo tech */

    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --text-accent: #22d3ee;
    --text-color: #ffffff;

    /* Animation */
    --animation-duration: 0.7s;

    /* Neon Effect - INTENSIFIED */
    --neon-glow-color: #22d3ee;
    --neon-glow-color-shadow: rgba(34, 211, 238, 0.4);
    --neon-red: #ef4444;
    --neon-red-shadow: rgba(239, 68, 68, 0.4);
}

/* === CUSTOM NEON SCROLLBAR === */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #05050a;
    border-left: 1px solid rgba(255,255,255,0.1);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--neon-glow-color), var(--neon-red));
    border-radius: 0; /* Tech square look */
    border: 2px solid #05050a;
    transition: all 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: #fff;
    box-shadow: 0 0 15px var(--neon-glow-color);
}

/* === DIGITAL PARTICLES === */
.particle {
    position: fixed;
    width: 3px;
    height: 3px;
    background: var(--neon-glow-color);
    box-shadow: 0 0 5px var(--neon-glow-color);
    pointer-events: none;
    z-index: -5;
    border-radius: 50%; /* Or 0 for square pixels */
    opacity: 0;
}

@keyframes floatUp {
    0% { 
        transform: translateY(105vh) scale(0); 
        opacity: 0; 
    }
    20% { 
        opacity: 0.8; 
    }
    80% {
        opacity: 0.4;
    }
    100% { 
        transform: translateY(-10vh) scale(1.5); 
        opacity: 0; 
    }
}

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

/* Animated Background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -10;
    background: var(--black-deep);
}

.bg-image {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -9;
    opacity: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    /* animation: removed; controlled individually */
    filter: brightness(1.1) contrast(1.1);
}

.bg-image:nth-child(1) {
    background-image: url('/assets/saber.png');
    animation: hardcoreGlitch 12s steps(1) infinite;
}

.bg-image:nth-child(2) {
    background-image: url('/assets/bambietta.png');
    background-position: center 30%;
    filter: brightness(1.2) contrast(1.2) saturate(1.1);
    animation: hardcoreGlitch 12s steps(1) infinite;
    animation-delay: 6s;
}

/* HARDCORE SIGNAL GLITCH */
@keyframes hardcoreGlitch {
    0% { opacity: 0; clip-path: inset(50% 0 50% 0); transform: translateX(-100px); }
    
    /* ENTER GLITCH SEQUENCE */
    1% { opacity: 1; clip-path: inset(10% 0 60% 0); transform: translateX(20px) skewX(50deg); filter: hue-rotate(90deg) contrast(3); }
    2% { clip-path: inset(80% 0 5% 0); transform: translateX(-20px) skewY(10deg) scale(1.1); filter: invert(1); }
    3% { clip-path: inset(0 0 0 0); transform: translate(5px, 5px); filter: none; }
    4% { clip-path: inset(40% 0 40% 0); transform: translateX(-5px) skewX(-20deg); filter: brightness(3) saturate(0); }
    5% { clip-path: none; transform: none; filter: none; opacity: 1; }
    
    /* STABLE VISIBILITY */
    45% { opacity: 1; transform: none; filter: none; }
    
    /* EXIT GLITCH SEQUENCE */
    46% { opacity: 1; clip-path: inset(0 0 70% 0); transform: scale(1.05) skewX(30deg); filter: hue-rotate(180deg); }
    47% { clip-path: inset(60% 0 0 0); transform: translateX(-50px) scale(1.1); filter: invert(1) contrast(2); }
    48% { clip-path: inset(40% 0 40% 0); transform: scale(0.9); filter: brightness(0.5); }
    49% { opacity: 0; clip-path: inset(50% 0 50% 0); transform: translateX(100px); }
    100% { opacity: 0; }
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -8;
    /* Reduced opacity for better image visibility */
    background: 
        linear-gradient(135deg, 
            rgba(239, 68, 68, 0.05) 0%, 
            rgba(10, 10, 20, 0.2) 40%, /* More transparent center */
            rgba(0, 212, 255, 0.05) 100%);
    animation: gradientShift 20s ease infinite;
    pointer-events: none; /* Let clicks pass through */
}

@keyframes gradientShift {
    0%, 100% { 
        background: linear-gradient(135deg, 
            rgba(239, 68, 68, 0.15) 0%, 
            rgba(10, 10, 20, 0.8) 40%,
            rgba(0, 212, 255, 0.15) 100%);
    }
    50% { 
        background: linear-gradient(135deg, 
            rgba(0, 212, 255, 0.15) 0%, 
            rgba(10, 10, 20, 0.8) 40%,
            rgba(239, 68, 68, 0.15) 100%);
    }
}

body {
    font-family: var(--primary-font);
    margin: 0;
    padding: 20px;
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 16px;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

header {
    text-align: center;
    margin-bottom: 2em;
    animation: fadeInSlideUp var(--animation-duration) ease-out forwards;
}

header h1 {
    margin: 0;
    font-size: 5em; /* Massive Size */
    font-weight: 900;
    font-style: italic; /* Speed/Action feel */
    letter-spacing: -2px;
    line-height: 0.9;
    text-transform: uppercase;
    color: #fff;
    text-shadow: 
        4px 4px 0px var(--neon-red),
        -2px -2px 0px var(--neon-glow-color);
    position: relative;
    display: inline-block;
    transform: skew(-5deg); /* Slight aggressive skew */
}

header h1::after {
    content: 'WORKFLOW';
    position: absolute;
    bottom: -15px;
    right: -20px;
    font-size: 0.2em;
    letter-spacing: 10px;
    color: var(--neon-glow-color);
    text-shadow: none;
    font-weight: 400;
    transform: skew(5deg); /* Counter skew */
}

.subtitle {
    display: none; /* Hide old subtitle */
}

/* Estilos para el contenedor principal de las tablas - TRANSPARENT WRAPPER */
#tables-container {
    max-width: 1400px;
    margin: 2em auto;
    padding: 0; /* Remove padding to align with main */
    position: relative;
    background: transparent; /* Remove glass */
    box-shadow: none; /* Remove shadow */
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: none; /* Remove border */
    overflow: visible;
}

/* Remove old snake border from tables-container */
#tables-container::before {
    display: none;
}

@keyframes snake_border_animation_container {
    0%   { background-size: 0% 2px, 2px 0%, 0% 2px, 2px 0%; opacity: 0; }
    5%   { opacity: 1; } /* Aparece */
    25%  { background-size: 100% 2px, 2px 0%, 0% 2px, 2px 0%; opacity: 1; }
    50%  { background-size: 100% 2px, 2px 100%, 0% 2px, 2px 0%; opacity: 1; }
    75%  { background-size: 100% 2px, 2px 100%, 100% 2px, 2px 0%; opacity: 1; }
    95%  { opacity: 1; } /* Se mantiene visible antes de desvanecerse */
    100% { background-size: 100% 2px, 2px 100%, 100% 2px, 2px 100%; opacity: 0; } /* Se desvanece */
}

.title-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px; /* Espacio entre logos y título */
    margin-bottom: 0.5em;
}

.logo svg {
    width: 40px; /* Bigger */
    height: 40px;
    display: block; 
    filter: drop-shadow(0 0 8px var(--neon-glow-color));
    transition: all 0.3s ease;
}

.logo:hover svg {
    transform: scale(1.2) rotate(10deg);
    filter: drop-shadow(0 0 15px var(--neon-red));
}

.subtitle {
    font-size: 1.1em;
    color: var(--text-secondary);
    letter-spacing: 1.5px;
    font-weight: 300;
    margin-top: 0;
}

.animated-subtitle {
    animation: pulseText 2.5s infinite ease-in-out;
}

@keyframes pulseText {
    0%, 100% {
        opacity: 0.6;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.03);
    }
}

main {
    max-width: 1400px;
    margin: 40px auto;
    padding: 40px;
    background: var(--glass-bg-color);
    backdrop-filter: blur(var(--glass-blur-intensity));
    -webkit-backdrop-filter: blur(var(--glass-blur-intensity));
    border-radius: var(--glass-border-radius);
    
    /* Tech Borders */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: 2px solid var(--neon-glow-color);
    border-bottom: 2px solid var(--neon-red);
    
    box-shadow:
        0 0 20px rgba(0,0,0,0.5),
        0 0 0 1px rgba(34, 211, 238, 0.1); /* Inner delicate border */
        
    position: relative;
    overflow: hidden;
    animation: fadeInSlideUp var(--animation-duration) ease-out 0.2s forwards;
    opacity: 0;
}

/* SCANLINE OVERLAY */
main::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent 0px,
        transparent 2px,
        rgba(0, 0, 0, 0.1) 3px
    );
    pointer-events: none;
    z-index: 0;
    opacity: 0.5;
}

/* Decoración de esquinas tipo "Magazine Tech" - Adjusted z-index */
.tech-corner-tl {
    position: absolute;
    top: 0;
    left: 0;
    width: 40px;
    height: 40px;
    border-top: 4px solid var(--neon-glow-color);
    border-left: 4px solid var(--neon-glow-color);
    box-shadow: -2px -2px 10px var(--neon-glow-color-shadow);
    z-index: 10;
}

.tech-corner-br {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 40px;
    height: 40px;
    border-bottom: 4px solid var(--neon-red);
    border-right: 4px solid var(--neon-red);
    box-shadow: 2px 2px 10px var(--neon-red-shadow);
    z-index: 10;
}

/* Elementos decorativos extra */
.tech-decoration-tl {
    position: absolute;
    top: 10px;
    right: 10px;
    font-family: monospace;
    font-size: 10px;
    color: var(--neon-glow-color);
    opacity: 0.7;
    letter-spacing: 2px;
}

.tech-decoration-tl::after {
    content: "SYS.ONLINE // V.2.0";
}

.tech-decoration-br {
    position: absolute;
    bottom: 10px;
    left: 10px;
    font-family: monospace;
    font-size: 10px;
    color: var(--neon-red);
    opacity: 0.7;
    letter-spacing: 2px;
}

.tech-decoration-br::after {
    content: "TARGET: COMMISSION_DATA";
}


/* Search Container */
.search-container {
    position: relative;
    max-width: 600px;
    margin: 0 auto 30px;
    animation: fadeInSlideUp var(--animation-duration) ease-out 0.3s forwards;
    opacity: 0;
}

#client-search {
    width: 100%;
    padding: 15px 50px 15px 25px;
    font-size: 16px;
    font-family: 'Courier New', monospace; /* Tech feel */
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--text-secondary);
    border-left: 4px solid var(--neon-glow-color);
    border-radius: 2px; /* Sharp corners */
    color: var(--text-accent);
    outline: none;
    transition: all 0.3s ease;
    clip-path: polygon(
        0 0, 
        100% 0, 
        100% calc(100% - 10px), 
        calc(100% - 10px) 100%, 
        0 100%
    ); /* Cut corner effect */
}

#client-search::placeholder {
    color: rgba(255, 255, 255, 0.3);
    font-family: var(--primary-font);
    letter-spacing: 1px;
    text-transform: uppercase;
    font-size: 0.8em;
}

#client-search:focus {
    background: rgba(0, 0, 0, 0.5);
    border-color: var(--neon-glow-color);
    box-shadow: 0 0 20px rgba(34, 211, 238, 0.1);
}

.search-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--neon-glow-color);
    border: none;
    border-radius: 2px;
    padding: 8px 15px;
    color: #000;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    clip-path: polygon(10px 0, 100% 0, 100% 100%, 0 100%, 0 10px);
}

.search-btn:hover {
    background: #fff;
    transform: translateY(-50%);
    box-shadow: 0 0 15px var(--neon-glow-color);
}

#clear-search {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    color: var(--text-color);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

#clear-search:hover {
    background: rgba(255, 59, 92, 0.8);
    transform: translateY(-50%) scale(1.1);
}

/* Modal tipo Carrito de Compras */
.user-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
    overflow-y: auto;
    pointer-events: all; /* Asegurar que el modal capture eventos */
}

.user-modal-content {
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.95), rgba(10, 10, 20, 0.98));
    border: 2px solid var(--cyan-bright);
    border-radius: 20px;
    max-width: 800px;
    width: 90%;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 
        0 0 30px rgba(34, 211, 238, 0.4),
        0 0 60px rgba(239, 68, 68, 0.2),
        0 20px 80px rgba(0, 0, 0, 0.7);
    animation: slideUp 0.4s ease;
    position: relative;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    color: var(--text-color);
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.modal-close:hover {
    background: rgba(255, 59, 92, 0.8);
    transform: rotate(90deg);
    border-color: rgba(255, 59, 92, 1);
}

.user-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 30px;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.2), rgba(139, 92, 246, 0.1));
    border-bottom: 2px solid var(--neon-glow-color);
}

.user-avatar {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--neon-glow-color), rgba(139, 92, 246, 0.8));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    box-shadow: 0 0 20px var(--neon-glow-color-shadow);
}

.user-info h2 {
    margin: 0;
    font-size: 28px;
    color: var(--neon-glow-color);
    text-shadow: 0 0 10px var(--neon-glow-color-shadow);
}

.user-info p {
    margin: 5px 0 0;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

.commissions-list {
    padding: 20px;
    max-height: calc(85vh - 180px);
    overflow-y: auto;
}

.commission-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(124, 58, 237, 0.3);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.commission-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--neon-glow-color);
    transform: translateX(5px);
    box-shadow: 0 0 15px var(--neon-glow-color-shadow);
}

.commission-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.commission-character {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
}

.commission-details {
    display: flex;
    gap: 20px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
}

.commission-detail {
    display: flex;
    align-items: center;
    gap: 5px;
}

.commission-detail strong {
    color: var(--text-color);
}

/* Ocultar Paid en modal (todas las resoluciones) */
.paid-status {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.table-section {
    margin-bottom: 2.5em;
    animation: fadeInSlideUp var(--animation-duration) ease-out 0.4s forwards; /* Staggered animation */
    opacity: 0; /* Start hidden for animation */
}

.table-section:last-child {
    margin-bottom: 0;
}

.table-section h2 {
    color: var(--cyan-bright);
    border-bottom: 2px solid var(--glass-border-color);
    padding-bottom: 0.6em;
    margin-bottom: 1em;
    font-size: 1.8em;
    font-weight: 600;
    text-shadow: 0 0 10px var(--neon-glow-color-shadow);
    letter-spacing: 1px;
}

table {
    width: 100%;
    border-collapse: collapse; /* Collapse borders for cleaner look */
    border-spacing: 0;
    margin-top: 1em;
    font-size: 0.95em;
    background: transparent;
    border-radius: 0; /* Sharp corners */
    border: none;
    box-shadow: none;
}

th, td {
    padding: 15px;
    text-align: center;
    vertical-align: middle;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05); /* Subtle separator */
}

tr:last-child td {
    border-bottom: none;
}

th {
    background: rgba(0, 0, 0, 0.6);
    color: var(--cyan-bright);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.9em;
    border-bottom: 2px solid var(--neon-glow-color);
    position: relative;
}

/* Remove rounded corners from headers */
th:first-child { border-top-left-radius: 0; }
th:last-child { border-top-right-radius: 0; }

/* Remove fancy shimmers/gradients from headers for a cleaner look */
th::before, th::after {
    display: none;
}

/* Row Styling */
table tr {
    transition: all 0.2s ease-out;
    position: relative;
}

table tr:hover {
    transform: translateX(10px); /* Slight shift right */
    background: rgba(34, 211, 238, 0.05); /* Very subtle cyan tint */
    z-index: 1;
    box-shadow: none; /* Remove heavy shadow */
}

/* Left indicator line on hover */
table tr td:first-child {
    position: relative;
}

table tr:hover td:first-child::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--neon-glow-color);
    box-shadow: 0 0 10px var(--neon-glow-color);
}

/* Remove rounded corners from row hover */
tr:hover td {
    background-color: transparent; 
}

/* Tech Tags for Status */
.commission-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 2px; /* Sharp */
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}

.commission-status::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background: rgba(255,255,255,0.5);
}

.commission-status.pending {
    background: rgba(251, 191, 36, 0.1);
    color: #fbbf24;
    border: 1px solid #fbbf24;
}

.commission-status.in_process {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    border: 1px solid #3b82f6;
}

.commission-status.done {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border: 1px solid #22c55e;
}

.commission-status.completed {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid #10b981;
}

/* Initial loading message */
#tables-container > p {
    text-align: center;
    font-size: 1.2em;
    padding: 3em 1em;
    color: var(--text-secondary);
    animation: fadeInSlideUp var(--animation-duration) ease-out forwards;
}

/* ============================================================================ */
/* SEPARADOR Y ESTILOS PARA HISTORIAL DE COMISIONES COMPLETADAS */
/* ============================================================================ */

/* Separador visual antes del historial */
.history-separator {
    margin: 4em 0 3em 0;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent,
        rgba(216, 180, 254, 0.3),
        rgba(150, 120, 200, 0.5),
        rgba(216, 180, 254, 0.3),
        transparent
    );
    position: relative;
    border-radius: 2px;
}

.history-separator::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: radial-gradient(circle, 
        rgba(216, 180, 254, 0.4) 0%,
        rgba(216, 180, 254, 0.2) 40%,
        transparent 70%
    );
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

.history-separator::after {
    content: "📖";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5em;
    background: rgba(88, 70, 120, 0.9);
    padding: 0.5em;
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(216, 180, 254, 0.4);
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.6;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

.history-section {
    margin-top: 1em;
    padding: 2.5em;
    background: linear-gradient(135deg, 
        rgba(88, 70, 120, 0.4), 
        rgba(58, 45, 88, 0.3));
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: var(--glass-border-radius);
    border: 1px solid rgba(180, 150, 255, 0.3);
    box-shadow: 
        0 8px 32px 0 rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    animation: fadeInSlideUp var(--animation-duration) ease-out 0.6s forwards;
    opacity: 0;
}

.history-section::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, 
        transparent 30%, 
        rgba(216, 180, 254, 0.03) 50%, 
        transparent 70%);
    border-radius: var(--glass-border-radius);
    animation: shimmer 4s linear infinite;
    pointer-events: none;
    overflow: hidden;
    z-index: 1;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.history-header {
    text-align: center;
    margin-bottom: 2em;
    position: relative;
    z-index: 2;
}

/* Estilos unificados para todas las tablas */
table {
    table-layout: fixed; /* Distribución fija de columnas */
    width: 100%;
}

/* Distribución de columnas para tablas principales */
/* COMENTADO: Ahora mostramos la columna Done como primera columna */
/* table th:first-child, 
table td:first-child {
    display: none;
} */

/* Done column (primera columna visible) */
table th:nth-child(1),
table td:nth-child(1) {
    width: 8%;
    text-align: center;
}

/* Date column - Tech Font */
table th:nth-child(2),
table td:nth-child(2) {
    width: 15%;
    text-align: center;
    font-family: 'Courier New', monospace;
    letter-spacing: -0.5px;
    font-weight: 600;
    color: var(--cyan-bright);
}

/* Character column */
table th:nth-child(3),
table td:nth-child(3) {
    width: 35%;
    text-align: center;
}

/* Name column */
table th:nth-child(4),
table td:nth-child(4) {
    width: 25%;
    text-align: center;
}

/* Status column */
table th:nth-child(5),
table td:nth-child(5) {
    width: 17%;
    text-align: center;
}

.history-title {
    font-size: 2.4em;
    font-weight: 300;
    color: var(--text-accent);
    margin: 0 0 0.5em 0;
    text-shadow: 0 0 25px rgba(216, 180, 254, 0.7);
    letter-spacing: 1.5px;
    position: relative;
}

.history-title::after {
    content: "";
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(216, 180, 254, 0.6), 
        transparent
    );
    border-radius: 2px;
}

.history-subtitle {
    color: var(--text-secondary);
    font-size: 1.1em;
    margin: 0;
    opacity: 0.8;
    font-style: italic;
}

.history-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 1.5em;
}

/* Contenedores de mes */
.month-container {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(200, 200, 255, 0.15);
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.month-container:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.2),
        0 0 20px rgba(216, 180, 254, 0.1);
    border-color: rgba(216, 180, 254, 0.3);
}

.month-container.expanded {
    box-shadow: 
        0 8px 30px rgba(0, 0, 0, 0.25),
        0 0 25px rgba(216, 180, 254, 0.15);
}

/* Encabezado de mes */
.month-header {
    padding: 1.2em 1.5em;
    background: linear-gradient(135deg, 
        rgba(100, 80, 140, 0.3), 
        rgba(70, 55, 100, 0.4));
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.month-header:hover {
    background: linear-gradient(135deg, 
        rgba(120, 100, 160, 0.4), 
        rgba(90, 75, 120, 0.5));
}

.month-header::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.1), 
        transparent);
    transition: left 0.5s ease;
    overflow: hidden;
}

.month-header:hover::before {
    left: 100%;
}

.month-title {
    font-size: 1.4em;
    font-weight: 400;
    color: var(--text-primary);
    margin: 0;
    text-transform: capitalize;
    flex: 0 0 auto;
    z-index: 1;
}

.commission-count {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(216, 180, 254, 0.2);
    color: var(--text-accent);
    padding: 0.3em 0.8em;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 500;
    border: 1px solid rgba(216, 180, 254, 0.3);
    z-index: 1;
}

.expand-arrow {
    flex: 0 0 auto;
    margin-left: auto;
    font-size: 1.2em;
    color: var(--text-accent);
    transition: transform 0.3s ease;
    user-select: none;
    z-index: 1;
}

.month-container.expanded .expand-arrow {
    transform: rotate(180deg);
}

/* Contenido de mes */
.month-content {
    padding: 1em 1.5em; /* Más padding para espaciar mejor */
    background: rgba(0, 0, 0, 0.1);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        max-height: 0;
        opacity: 0;
    }
    to {
        max-height: 500px;
        opacity: 1;
    }
}

/* Tablas del historial */
.history-table {
    width: 95%; /* Usar casi todo el ancho disponible */
    border-collapse: separate;
    border-spacing: 0;
    margin: 1.5em auto; /* Centrar tabla con más margen vertical */
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border: none;
    overflow: hidden;
    min-width: 600px; /* Ancho mínimo */
    table-layout: fixed; /* Distribución fija de columnas */
}

.history-table th,
.history-table td {
    padding: 1em 1.5em;
    border-bottom: 1px solid rgba(200, 200, 255, 0.1);
    transition: all 0.2s ease;
    vertical-align: middle;
}

/* Alineación específica por columna */
.history-table th:nth-child(1), /* Date (primera columna en historial) */
.history-table td:nth-child(1) {
    text-align: center;
    width: 25%; /* Ancho fijo para fecha */
}

.history-table th:nth-child(2), /* Character */
.history-table td:nth-child(2) {
    text-align: center;
    width: 45%; /* Más espacio para character */
}

.history-table th:nth-child(3), /* Client */
.history-table td:nth-child(3) {
    text-align: center;
    width: 30%; /* Espacio moderado para client */
}

/* COMENTADO: Ahora mostramos la primera columna */
/* .history-table th:first-child,
.history-table td:first-child {
    display: none;
} */

.history-table th {
    background: rgba(216, 180, 254, 0.1);
    color: var(--text-accent);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.9em;
    position: relative;
}

.history-table th:first-child {
    border-top-left-radius: 0;
}

.history-table th:last-child {
    border-top-right-radius: 0;
}

.history-table tbody tr {
    transition: all 0.2s ease;
    position: relative;
}

.history-table tbody tr:hover {
    background: rgba(216, 180, 254, 0.08);
    transform: translateX(5px);
}

.history-table tbody tr:hover td {
    color: var(--text-primary);
    text-shadow: 0 0 10px rgba(216, 180, 254, 0.3);
}

.history-table tbody tr:last-child td {
    border-bottom: none;
}

.history-table td {
    color: var(--text-secondary);
    font-size: 0.95em;
}

/* ===== RESPONSIVE DESIGN PARA MÓVILES ÚNICAMENTE ===== */
@media screen and (max-width: 768px) {
    /* Layout general para móvil */
    body {
        padding: 10px;
        font-size: 14px;
    }
    
    .main-container {
        padding: 15px;
        margin: 0;
    }
    
    h1 {
        font-size: 1.8em;
        margin-bottom: 1em;
    }
    
    /* Tablas principales - Layout móvil */
    .table-section {
        margin-bottom: 1.5em;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table-section h2 {
        font-size: 1.3em;
        margin-bottom: 0.8em;
        text-align: center;
    }
    
    /* Rediseño de tablas para móvil */
    table {
        width: 100%;
        font-size: 0.8em;
        border-collapse: separate;
        border-spacing: 0;
    }
    
    /* Tabla principal en móvil SIN Status para evitar scroll horizontal */
    table:not(.history-table) th:nth-child(1), /* Done */
    table:not(.history-table) td:nth-child(1) {
        width: 10%;
        font-size: 0.7em;
    }
    
    table:not(.history-table) th:nth-child(2), /* Date */
    table:not(.history-table) td:nth-child(2) {
        width: 20%;
        font-size: 0.7em;
    }
    
    table:not(.history-table) th:nth-child(3), /* Character */
    table:not(.history-table) td:nth-child(3) {
        width: 45%;
        font-size: 0.75em;
        line-height: 1.2;
    }
    
    table:not(.history-table) th:nth-child(4), /* Name */
    table:not(.history-table) td:nth-child(4) {
        width: 25%;
        font-size: 0.7em;
        word-break: break-all;
    }
    
    table:not(.history-table) th:nth-child(5), /* Status */
    table:not(.history-table) td:nth-child(5) {
        width: 20%;
        font-size: 0.65em;
        line-height: 1.1;
        white-space: nowrap;
        text-overflow: ellipsis;
        overflow: hidden;
        word-break: break-all;
    }
    
    /* Tabla del historial en móvil con scroll horizontal */
    .month-content {
        padding: 8px !important;
        overflow-x: auto !important;
        overflow-y: visible !important;
        width: 100% !important;
        box-sizing: border-box !important;
        margin: 0 !important;
    }
    
    .history-table {
        min-width: 350px !important;
        width: 100% !important;
        table-layout: fixed !important;
        border-collapse: collapse !important;
        font-size: 0.75em !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }
    
    .history-table thead,
    .history-table tbody,
    .history-table tr {
        width: 100% !important;
        display: table-row !important;
        overflow: visible !important;
    }
    
    .history-table th,
    .history-table td {
        display: table-cell !important;
        padding: 8px 4px !important;
        text-align: center !important;
        vertical-align: middle !important;
        border: 1px solid rgba(200, 200, 255, 0.1) !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        box-sizing: border-box !important;
    }
    
    /* COMENTADO: Ahora mostramos la primera columna */
    /* .history-table th:first-child,
    .history-table td:first-child {
        display: none !important;
    } */
    
    /* Columnas del historial con scroll horizontal - anchos generosos */
    .history-table th:nth-child(1), /* Date header */
    .history-table td:nth-child(1) { /* Date data */
        width: 80px !important;
        min-width: 80px !important;
        font-size: 0.75em !important;
        text-align: center !important;
        padding: 8px 6px !important;
        vertical-align: middle !important;
    }
    
    .history-table th:nth-child(2), /* Character header */
    .history-table td:nth-child(2) { /* Character data */
        width: 160px !important;
        min-width: 160px !important;
        font-size: 0.75em !important;
        text-align: center !important;
        padding: 8px 6px !important;
        vertical-align: middle !important;
        white-space: nowrap !important;
    }
    
    .history-table th:nth-child(3), /* Client header */
    .history-table td:nth-child(3) { /* Client data */
        width: 110px !important;
        min-width: 110px !important;
        font-size: 0.75em !important;
        text-align: center !important;
        padding: 8px 6px !important;
        vertical-align: middle !important;
    }
    
    /* Ocultar el resto de columnas */
    .history-table th:nth-child(n+4),
    .history-table td:nth-child(n+4) {
        display: none !important;
    }
    
    table th, table td {
        padding: 8px 4px;
        border-bottom: 1px solid rgba(200, 200, 255, 0.1);
    }
    
    /* Historial para móvil */
    .history-section {
        margin-top: 2em;
        padding: 15px;
    }
    
    .history-title {
        font-size: 1.5em;
        margin-bottom: 0.5em;
    }
    
    .history-subtitle {
        font-size: 0.9em;
        margin-bottom: 1.5em;
    }
    
    /* Contenedores de mes para móvil */
    .month-container {
        margin-bottom: 1em;
        overflow: visible;
    }
    
    .month-content {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0;
    }
    
    .month-header {
        padding: 10px 12px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
    }
    
    .commission-count {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    }
    
    .month-title {
        font-size: 0.95em !important;
        margin: 0 !important;
        flex: 0 1 auto;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 50%;
    }
    
    .commission-count {
        font-size: 0.7em !important;
        padding: 2px 6px !important;
        white-space: nowrap;
        flex: 0 0 auto;
        margin: 0 !important;
    }
    
    .expand-arrow {
        font-size: 1em !important;
        flex: 0 0 auto;
        width: 20px;
        text-align: center;
        margin: 0 !important;
    }
    
    /* Tablas del historial para móvil */
    .history-table {
        font-size: 0.8em;
        margin: 0;
        width: 100%;
        display: table;
        table-layout: fixed;
    }
    
    .history-table thead {
        display: table-header-group;
    }
    
    .history-table tbody {
        display: table-row-group;
    }
    
    .history-table tr {
        display: table-row;
    }
    
    .history-table th, 
    .history-table td {
        display: table-cell;
        padding: 8px 4px;
        vertical-align: middle;
        text-align: center;
    }
    
    /* Ajustar las columnas del historial en móvil */
    .history-table th:nth-child(1), /* Date */
    .history-table td:nth-child(1) {
        width: 30%;
        font-size: 0.75em;
        text-align: center;
    }
    
    .history-table th:nth-child(2), /* Character */
    .history-table td:nth-child(2) {
        width: 45%;
        font-size: 0.8em;
        line-height: 1.2;
        text-align: center;
    }
    
    .history-table th:nth-child(3), /* Client */
    .history-table td:nth-child(3) {
        width: 25%;
        font-size: 0.7em;
        word-break: break-all;
        text-align: center;
    }
    
    /* Asegurar que los encabezados se vean */
    .history-table th {
        background: rgba(216, 180, 254, 0.15);
        color: var(--text-accent);
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        border-bottom: 2px solid rgba(216, 180, 254, 0.3);
    }
    
    /* Estilo para las filas de datos */
    .history-table td {
        color: var(--text-secondary);
        border-bottom: 1px solid rgba(200, 200, 255, 0.1);
    }
    
    /* Mejorar interacción táctil */
    .month-header {
        min-height: 44px; /* Tamaño mínimo para toque */
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(216, 180, 254, 0.2);
    }
    
    /* Animaciones más suaves en móvil */
    .month-content {
        transition: all 0.3s ease-out;
    }
    
    /* Scroll horizontal suave para tablas si es necesario */
    .table-section::-webkit-scrollbar,
    .month-content::-webkit-scrollbar {
        height: 4px;
    }
    
    .table-section::-webkit-scrollbar-track,
    .month-content::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.1);
        border-radius: 2px;
    }
    
    .table-section::-webkit-scrollbar-thumb,
    .month-content::-webkit-scrollbar-thumb {
        background: var(--neon-glow-color);
        border-radius: 2px;
    }
}

/* Para pantallas muy pequeñas (móviles en vertical) */
@media screen and (max-width: 480px) {
    body {
        padding: 8px;
        font-size: 13px;
    }
    
    .main-container {
        padding: 10px;
    }
    
    h1 {
        font-size: 1.6em;
    }
    
    .table-section h2 {
        font-size: 1.2em;
    }
    
    table {
        font-size: 0.75em;
    }
    
    .history-title {
        font-size: 1.3em;
    }
    
    .month-title {
        font-size: 1em;
    }
    
    /* Hacer más compacto en pantallas muy pequeñas */
    table th, table td {
        padding: 6px 3px;
    }
    
    .history-table th, .history-table td {
        padding: 8px 4px;
    }
}

/* Columna de fecha (primera columna visible en historial) */
.history-table td:nth-child(1) {
    font-family: 'Courier New', monospace;
    font-weight: 500;
    color: var(--text-accent);
    background: rgba(216, 180, 254, 0.05);
}

/* Columna de cliente (tercera columna visible en historial) */
.history-table td:nth-child(3) {
    font-weight: 500;
}

/* Columna de descripción */
.history-table td:last-child {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-table td:last-child:hover {
    white-space: normal;
    word-wrap: break-word;
    max-width: none;
}

/* Responsive design para el historial */
@media (max-width: 768px) {
    .history-section {
        margin-top: 2em;
        padding: 1.5em;
    }
    
    .history-title {
        font-size: 1.8em;
    }
    
    .month-header {
        padding: 1em;
        display: flex !important;
        flex-direction: column;
        align-items: center;
        gap: 0.5em;
    }
    
    .commission-count {
        position: static;
        transform: none;
    }
    
    .month-title {
        font-size: 1.2em;
    }
    
    .history-table {
        font-size: 0.85em;
    }
    
    .history-table th,
    .history-table td {
        padding: 0.8em 0.5em;
    }
    
    .history-table td:last-child {
        max-width: 150px;
    }
}

/* Animación de entrada para las filas del historial */
.history-table tbody tr {
    animation: fadeInUp 0.4s ease forwards;
    opacity: 0;
    transform: translateY(10px);
}

.history-table tbody tr:nth-child(1) { animation-delay: 0.1s; }
.history-table tbody tr:nth-child(2) { animation-delay: 0.15s; }
.history-table tbody tr:nth-child(3) { animation-delay: 0.2s; }
.history-table tbody tr:nth-child(4) { animation-delay: 0.25s; }
.history-table tbody tr:nth-child(5) { animation-delay: 0.3s; }
.history-table tbody tr:nth-child(n+6) { animation-delay: 0.35s; }

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Estado vacío del historial */
.history-empty {
    text-align: center;
    padding: 3em 2em;
    color: var(--text-secondary);
    font-style: italic;
    opacity: 0.7;
}

.history-empty::before {
    content: "📝";
    display: block;
    font-size: 3em;
    margin-bottom: 0.5em;
    opacity: 0.5;
}

/* ============================================
   RESPONSIVE - MOBILE OPTIMIZATIONS
   ============================================ */

/* Tablets y dispositivos medianos */
@media (max-width: 768px) {
    .search-container {
        max-width: 90%;
        margin: 0 auto 20px;
        padding: 0 10px;
    }
    
    #client-search {
        padding: 12px 40px 12px 15px;
        font-size: 14px;
    }
    
    .search-btn {
        right: 10px;
        padding: 6px 15px;
        font-size: 12px;
    }
    
    #clear-search {
        right: 10px;
        width: 28px;
        height: 28px;
        font-size: 16px;
    }
}

/* Smartphones */
@media (max-width: 480px) {
    .search-container {
        max-width: 100%;
        margin: 0 auto 12px;
        padding: 0;
        display: flex;
        justify-content: center;
    }
    
    #client-search {
        width: 80%;
        padding: 8px 70px 8px 10px;
        font-size: 11px;
        border-radius: 16px;
    }
    
    #client-search::placeholder {
        font-size: 10px;
    }
    
    .search-btn {
        right: 10%;
        padding: 4px 8px;
        font-size: 9px;
        border-radius: 10px;
    }
    
    #clear-search {
        right: 10%;
        width: 22px;
        height: 22px;
        font-size: 12px;
    }
    
    /* Modal de resultados - Móvil */
    .commission-card {
        padding: 14px;
        margin-bottom: 12px;
    }
    
    .commission-character {
        font-size: 15px;
        line-height: 1.3;
    }
    
    .commission-status {
        padding: 4px 10px;
        font-size: 11px;
    }
    
    .commission-details {
        flex-wrap: wrap;
        gap: 10px;
        font-size: 12px;
    }
    
    /* Ocultar Done en móvil (Paid ya está oculto globalmente) */
    .done-status {
        display: none !important;
    }
}

/* iPhone 12 Pro y similares (390px) */
@media (max-width: 390px) {
    .search-container {
        max-width: 100%;
        margin: 0 auto 10px;
        padding: 0;
        display: flex;
        justify-content: center;
    }
    
    #client-search {
        width: 80%;
        padding: 7px 60px 7px 8px;
        font-size: 10px;
        border-radius: 14px;
    }
    
    #client-search::placeholder {
        font-size: 9px;
    }
    
    .search-btn {
        right: 10%;
        padding: 3px 6px;
        font-size: 8px;
        border-radius: 8px;
    }
    
    #clear-search {
        right: 10%;
        width: 20px;
        height: 20px;
        font-size: 11px;
    }
    
    /* Modal de resultados de búsqueda - Móvil */
    .commission-card {
        padding: 12px;
        margin-bottom: 10px;
    }
    
    .commission-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        margin-bottom: 10px;
    }
    
    .commission-character {
        font-size: 14px;
        line-height: 1.3;
    }
    
    .commission-status {
        padding: 4px 10px;
        font-size: 10px;
    }
    
    .commission-details {
        flex-direction: column;
        gap: 8px;
        font-size: 11px;
    }
    
    .commission-detail {
        gap: 4px;
    }
    
    /* Ocultar Done en móvil (Paid ya está oculto globalmente) */
    .done-status {
        display: none !important;
    }
}

