/* ========================================
   NOVABUCAL - Design System
   ======================================== */

:root {
    /* Colores de Marca */
    --primary-yellow: #F2E36F;
    --dark-accent: #3A3A3A;
    --bg-white: #FFFFFF;
    --bg-soft: #F5F5F5;
    --text-dark: #2E2E2E;
    --text-medium: #6B6B6B;
    --text-light: #9B9B9B;
    --border-light: #E8E8E8;
    --error: #E63946;
    
    /* Colores para Login */
    --login-blue: #003366;
    --login-blue-hover: #004080;
    --login-blue-light: #004d99;
    
    /* Tipografía */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-brand: 'Poppins', sans-serif;
    
    /* Espaciado */
    --spacing-xs: 8px;
    --spacing-sm: 12px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;
    
    /* Bordes */
    --radius-sm: 10px;
    --radius-md: 12px;
    --radius-lg: 14px;
    
    /* Sombras */
    --shadow-soft: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-glow: 0 0 20px rgba(242, 227, 111, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    background: var(--bg-soft);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md);
    color: var(--text-dark);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.screen {
    display: none;
    width: 100%;
    max-width: 540px;
}

.screen.active {
    display: block;
}

/* Pantalla de Dashboard - más ancha y centrada */
#dashboardScreen {
    max-width: 900px;
    margin: 0 auto;
    position: relative;
}

#dashboardScreen .container {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Botón de cerrar sesión */
.dashboard-logout-container {
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
    z-index: 10;
}

.btn-logout {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-white);
    border: 2px solid var(--border-light);
    border-radius: 50%;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-logout:hover {
    background: var(--bg-soft);
    border-color: var(--text-dark);
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-logout:active {
    transform: scale(1.05);
}

.btn-logout svg {
    width: 20px;
    height: 20px;
}

.container {
    width: 100%;
}

/* ========================================
   Login Styles
   ======================================== */

.login-header {
    text-align: center;
    margin-bottom: var(--spacing-2xl);
}

.login-title {
    font-family: var(--font-primary);
    font-size: 28px;
    font-weight: 700;
    color: var(--login-blue);
    margin-bottom: var(--spacing-sm);
    letter-spacing: -0.5px;
}

.login-subtitle {
    font-size: 15px;
    color: var(--text-medium);
    font-weight: 400;
}

.btn-login {
    background: var(--login-blue);
    color: var(--bg-white);
    box-shadow: 0 4px 12px rgba(0, 51, 102, 0.2);
}

.btn-login:hover:not(:disabled) {
    background: var(--login-blue-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 51, 102, 0.3);
}

.btn-login:active:not(:disabled) {
    transform: translateY(0);
}

/* Login box específico */
#loginScreen .login-box {
    background: var(--bg-white);
    border-radius: 20px;
    padding: var(--spacing-2xl);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1),
                0 4px 16px rgba(0, 0, 0, 0.06),
                0 0 0 1px rgba(0, 0, 0, 0.04);
    animation: fadeInUp 0.5s ease-out;
    border: none;
    position: relative;
}

#loginScreen input[type="text"]:focus,
#loginScreen input[type="password"]:focus {
    outline: none;
    border-color: var(--login-blue);
    box-shadow: 0 0 0 3px rgba(0, 51, 102, 0.1);
    background: var(--bg-white);
}

/* ========================================
   Dashboard Styles
   ======================================== */

.dashboard-header {
    text-align: center;
    margin-bottom: var(--spacing-2xl);
}


.dashboard-title {
    font-family: var(--font-brand);
    font-size: 36px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: var(--spacing-xs);
    letter-spacing: -0.5px;
}


.dashboard-box {
    background: var(--bg-white);
    border-radius: 20px;
    padding: var(--spacing-2xl);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1),
                0 4px 16px rgba(0, 0, 0, 0.06),
                0 0 0 1px rgba(0, 0, 0, 0.04);
    animation: fadeInUp 0.5s ease-out;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 32px; /* gap-8 equivalente */
    margin-top: var(--spacing-xl);
}

.module-card {
    background: linear-gradient(135deg, var(--primary-yellow) 0%, #E6D85C 100%);
    border: 3px solid var(--text-dark);
    border-radius: 12px; /* rounded-xl */
    padding: var(--spacing-2xl);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); /* shadow-sm */
    position: relative;
    overflow: hidden;
}

.module-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.05);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.module-card:hover {
    transform: scale(1.05); /* hover:scale-105 */
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); /* shadow-2xl */
    border-color: var(--text-dark);
}

.module-card:hover::before {
    opacity: 1;
}

.module-card:active {
    transform: scale(1.02);
}

.module-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--spacing-lg);
    background: var(--text-dark);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-yellow);
    position: relative;
    z-index: 1;
    transition: transform 0.3s ease;
}

.module-card:hover .module-icon {
    transform: scale(1.1);
}

.module-icon svg {
    width: 40px;
    height: 40px;
}

.module-title {
    font-family: var(--font-primary);
    font-size: 22px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: var(--spacing-sm);
    position: relative;
    z-index: 1;
}

.module-description {
    font-size: 14px;
    color: var(--text-dark);
    opacity: 0.8;
    line-height: 1.6;
    position: relative;
    z-index: 1;
}

/* ========================================
   Module Navigation
   ======================================== */

.module-header {
    margin-bottom: var(--spacing-lg);
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 var(--spacing-md);
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    background: transparent;
    border: 2px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-dark);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--font-primary);
}

.btn-back:hover {
    background: var(--bg-soft);
    border-color: var(--text-dark);
    transform: translateX(-2px);
}

.btn-back svg {
    width: 18px;
    height: 18px;
}

.module-content-box {
    background: var(--bg-white);
    border-radius: 20px;
    padding: var(--spacing-2xl);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1),
                0 4px 16px rgba(0, 0, 0, 0.06),
                0 0 0 1px rgba(0, 0, 0, 0.04);
    animation: fadeInUp 0.5s ease-out;
}

.module-content-header {
    text-align: center;
    margin-bottom: var(--spacing-2xl);
}

.module-content-title {
    font-family: var(--font-primary);
    font-size: 36px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: var(--spacing-sm);
    letter-spacing: -0.5px;
}

.module-content-subtitle {
    font-size: 18px;
    color: var(--text-medium);
    font-weight: 500;
}

.empty-state {
    text-align: center;
    padding: var(--spacing-2xl);
    color: var(--text-medium);
    font-size: 16px;
}

/* ========================================
   Brand Header (para pantalla de grabación)
   ======================================== */

.brand-header {
    text-align: center;
    margin-bottom: var(--spacing-2xl);
}

.logo-container {
    width: 180px;
    height: 180px;
    margin: 0 auto var(--spacing-md);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeInScale 0.6s ease-out;
    position: relative;
}

.logo-container.small {
    width: 120px;
    height: 120px;
    margin-bottom: var(--spacing-sm);
}

.brand-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50px;
    display: block;
    filter: drop-shadow(0 0 15px rgba(242, 227, 111, 0.5)) 
            drop-shadow(0 0 30px rgba(242, 227, 111, 0.3))
            drop-shadow(0 4px 12px rgba(0, 0, 0, 0.1));
    animation: gentleGlow 3s ease-in-out infinite;
}

.logo-fallback {
    width: 100%;
    height: 100%;
    border-radius: 50px;
    animation: gentleGlow 3s ease-in-out infinite;
}

@keyframes gentleGlow {
    0%, 100% {
        filter: drop-shadow(0 0 15px rgba(242, 227, 111, 0.5)) 
                drop-shadow(0 0 30px rgba(242, 227, 111, 0.3))
                drop-shadow(0 4px 12px rgba(0, 0, 0, 0.1));
    }
    50% {
        filter: drop-shadow(0 0 20px rgba(242, 227, 111, 0.7)) 
                drop-shadow(0 0 40px rgba(242, 227, 111, 0.4))
                drop-shadow(0 4px 12px rgba(0, 0, 0, 0.1));
    }
}

.brand-logo {
    font-family: var(--font-brand);
    font-size: 32px;
    font-weight: 600;
    color: var(--dark-accent);
    margin-bottom: var(--spacing-xs);
    letter-spacing: -0.5px;
}

.brand-subtitle {
    font-size: 15px;
    color: var(--text-medium);
    font-weight: 400;
}

.page-title {
    font-family: var(--font-primary);
    font-size: 26px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0;
}

/* ========================================
   Cards (Login & Recorder)
   ======================================== */

.login-box,
.recorder-box {
    background: var(--bg-white);
    border-radius: 20px;
    padding: var(--spacing-2xl);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1),
                0 4px 16px rgba(0, 0, 0, 0.06),
                0 0 0 1px rgba(0, 0, 0, 0.04);
    animation: fadeInUp 0.5s ease-out;
    border: none;
    position: relative;
}


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

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ========================================
   Formularios
   ======================================== */

.patient-info {
    margin-bottom: var(--spacing-xl);
    background: var(--bg-soft);
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
    margin-top: var(--spacing-lg);
}

.input-group {
    margin-bottom: var(--spacing-lg);
}

.input-group:last-child {
    margin-bottom: 0;
}

label {
    display: block;
    margin-bottom: var(--spacing-sm);
    color: var(--text-dark);
    font-weight: 500;
    font-size: 14px;
    letter-spacing: 0.2px;
}

input[type="password"],
input[type="text"],
input[type="tel"],
select {
    width: 100%;
    padding: 14px var(--spacing-md);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: var(--font-primary);
    color: var(--text-dark);
    background: var(--bg-white);
    transition: all 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
}

/* Icono de flecha para select */
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%232E2E2E' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--spacing-md) center;
    background-size: 12px;
    padding-right: calc(var(--spacing-md) + 20px);
}

input[type="password"]:focus,
input[type="text"]:focus,
input[type="tel"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary-yellow);
    box-shadow: 0 0 0 3px rgba(242, 227, 111, 0.1);
    background: var(--bg-white);
}

input[type="password"]::placeholder,
input[type="text"]::placeholder,
input[type="tel"]::placeholder {
    color: var(--text-light);
}

/* Estilos para las opciones del select */
select option {
    padding: 12px;
    background: var(--bg-white);
    color: var(--text-dark);
}


.error-message {
    color: var(--error);
    font-size: 13px;
    margin-top: var(--spacing-sm);
    min-height: 20px;
    font-weight: 500;
}

/* ========================================
   Botones
   ======================================== */

.btn {
    width: 100%;
    padding: 16px var(--spacing-lg);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    letter-spacing: 0.3px;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--primary-yellow);
    color: var(--dark-accent);
    box-shadow: var(--shadow-soft);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(242, 227, 111, 0.35), var(--shadow-glow);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========================================
   Botón de Grabación
   ======================================== */

.recorder-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-lg);
    margin-top: var(--spacing-xl);
}

/* Botón de grabación circular */
.btn-record-circular {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--text-dark);
    color: var(--bg-white);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    position: relative;
    padding: 0;
}

.btn-record-circular:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.btn-record-circular:active:not(:disabled) {
    transform: scale(1.05);
}

.btn-record-circular:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-record-circular.recording {
    animation: recordingPulse 1.5s ease-in-out infinite;
}

.btn-record-circular.recording::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 3px solid var(--primary-yellow);
    border-radius: 50%;
    animation: recordingBorderPulse 1.5s ease-in-out infinite;
}

.record-icon-mic {
    width: 32px;
    height: 32px;
    color: var(--bg-white);
}

@keyframes recordingPulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 0 0 0 rgba(242, 227, 111, 0.4);
    }
    50% {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 0 0 8px rgba(242, 227, 111, 0);
    }
}

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

/* ========================================
   Estado de Grabación
   ======================================== */

.recording-status {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    color: var(--dark-accent);
    font-weight: 500;
    font-size: 15px;
}

.recording-status.hidden {
    display: none;
}

.pulse-animation {
    width: 10px;
    height: 10px;
    background: var(--primary-yellow);
    border-radius: 50%;
    animation: blink 1.2s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(242, 227, 111, 0.6);
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.9);
    }
}

.timer {
    font-size: 36px;
    font-weight: 600;
    color: var(--text-dark);
    font-family: var(--font-primary);
    letter-spacing: 2px;
    margin: var(--spacing-sm) 0;
}

.timer.hidden {
    display: none;
}

/* ========================================
   Botón de Descarga
   ======================================== */

.btn-download {
    background: var(--dark-accent);
    color: var(--bg-white);
    margin-top: var(--spacing-md);
    box-shadow: var(--shadow-medium);
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(58, 58, 58, 0.3);
    background: #2E2E2E;
}

.btn-download:active {
    transform: translateY(0);
}

.download-icon {
    width: 20px;
    height: 20px;
    stroke-width: 2.5;
}

.btn.hidden {
    display: none;
}

/* ========================================
   Audio Playback
   ======================================== */

.audio-player-wrapper {
    width: 100%;
    margin-top: var(--spacing-xl);
    background: var(--bg-soft);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-light);
}

.audio-player-wrapper.hidden {
    display: none;
}

.audio-player-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border-light);
}

.audio-icon {
    width: 24px;
    height: 24px;
    color: var(--dark-accent);
    flex-shrink: 0;
}

.audio-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    letter-spacing: 0.2px;
}

#audioPlayback,
#inventarioAudioPlayback {
    width: 100%;
    height: 48px;
    outline: none;
    border-radius: var(--radius-sm);
}

/* Personalización del reproductor de audio nativo */
#audioPlayback::-webkit-media-controls-panel,
#inventarioAudioPlayback::-webkit-media-controls-panel {
    background: var(--bg-white);
    border-radius: var(--radius-sm);
    padding: 0;
}

#audioPlayback::-webkit-media-controls-play-button,
#inventarioAudioPlayback::-webkit-media-controls-play-button {
    background-color: var(--primary-yellow);
    border-radius: 50%;
    margin-right: 8px;
}

#audioPlayback::-webkit-media-controls-current-time-display,
#audioPlayback::-webkit-media-controls-time-remaining-display,
#inventarioAudioPlayback::-webkit-media-controls-current-time-display,
#inventarioAudioPlayback::-webkit-media-controls-time-remaining-display {
    color: var(--text-dark);
    font-family: var(--font-primary);
    font-size: 13px;
    font-weight: 500;
}

#audioPlayback::-webkit-media-controls-timeline,
#inventarioAudioPlayback::-webkit-media-controls-timeline {
    background-color: var(--border-light);
    border-radius: 4px;
    height: 4px;
    margin: 0 12px;
}

#audioPlayback::-webkit-media-controls-timeline::-webkit-slider-thumb,
#inventarioAudioPlayback::-webkit-media-controls-timeline::-webkit-slider-thumb {
    background-color: var(--primary-yellow);
    border-radius: 50%;
    width: 14px;
    height: 14px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#audioPlayback::-webkit-media-controls-volume-slider,
#inventarioAudioPlayback::-webkit-media-controls-volume-slider {
    background-color: var(--border-light);
    border-radius: 4px;
    height: 4px;
}

#audioPlayback::-webkit-media-controls-volume-slider::-webkit-slider-thumb,
#inventarioAudioPlayback::-webkit-media-controls-volume-slider::-webkit-slider-thumb {
    background-color: var(--dark-accent);
    border-radius: 50%;
    width: 12px;
    height: 12px;
}

#audioPlayback::-webkit-media-controls-mute-button,
#inventarioAudioPlayback::-webkit-media-controls-mute-button {
    color: var(--dark-accent);
}

#audioPlayback::-webkit-media-controls-volume-slider-container,
#inventarioAudioPlayback::-webkit-media-controls-volume-slider-container {
    margin-left: 8px;
}

/* Para Firefox */
#audioPlayback::-moz-range-track,
#inventarioAudioPlayback::-moz-range-track {
    background-color: var(--border-light);
    border-radius: 4px;
    height: 4px;
}

#audioPlayback::-moz-range-thumb,
#inventarioAudioPlayback::-moz-range-thumb {
    background-color: var(--primary-yellow);
    border: none;
    border-radius: 50%;
    width: 14px;
    height: 14px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 600px) {
    body {
        padding: var(--spacing-sm);
    }
    
    .login-box,
    .recorder-box,
    .dashboard-box,
    .module-content-box {
        padding: var(--spacing-xl) var(--spacing-lg);
    }
    
    .login-title {
        font-size: 24px;
    }
    
    .dashboard-title {
        font-size: 28px;
    }
    
    .dashboard-logo-container {
        width: 80px;
        height: 80px;
    }
    
    .modules-grid {
        grid-template-columns: 1fr;
        gap: 24px; /* gap-6 en móvil */
    }
    
    .module-card {
        padding: var(--spacing-xl);
    }
    
    .module-icon {
        width: 60px;
        height: 60px;
    }
    
    .module-icon svg {
        width: 30px;
        height: 30px;
    }
    
    .module-title {
        font-size: 20px;
    }
    
    .brand-logo {
        font-size: 28px;
    }
    
    .page-title {
        font-size: 22px;
    }
    
    .patient-info {
        padding: var(--spacing-md);
    }
    
    .btn-record-circular {
        width: 70px;
        height: 70px;
    }
    
    .record-icon-mic {
        width: 28px;
        height: 28px;
    }
    
    .timer {
        font-size: 32px;
    }
    
    .logo-container {
        width: 150px;
        height: 150px;
    }
    
    .logo-container.small {
        width: 100px;
        height: 100px;
    }
    
    #dashboardScreen {
        max-width: 100%;
    }
}

@media (max-width: 400px) {
    .brand-logo {
        font-size: 24px;
    }
    
    .page-title {
        font-size: 20px;
    }
}

/* ========================================
   Módulo de Inventario
   ======================================== */

.inventario-recorder-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-lg);
    margin: var(--spacing-2xl) 0;
    min-height: 200px;
}

.inventario-recorder-container .audio-player-wrapper {
    margin-top: 0;
}

/* Botón de grabación circular para inventario (más grande - héroe) */
.btn-inventario-record {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: var(--text-dark);
    color: var(--bg-white);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    position: relative;
    padding: 0;
    overflow: visible;
}

.btn-inventario-record:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.btn-inventario-record:active:not(:disabled) {
    transform: scale(1.05);
}

.btn-inventario-record:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-inventario-record[data-state="grabando"] {
    animation: inventarioRecordingPulse 1.5s ease-in-out infinite;
}

.btn-inventario-record[data-state="grabando"]::before {
    content: '';
    position: absolute;
    top: -6px;
    left: -6px;
    right: -6px;
    bottom: -6px;
    border: 4px solid #FFCC00;
    border-radius: 50%;
    animation: inventarioBorderPulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(255, 204, 0, 0.6), 0 0 40px rgba(255, 204, 0, 0.4);
}

.record-icon-mic-large {
    width: 50px;
    height: 50px;
    color: var(--bg-white);
    position: relative;
    z-index: 2;
    transition: opacity 0.3s ease;
}

.btn-inventario-record[data-state="grabando"] .record-icon-mic-large {
    opacity: 0;
}

/* Animación de ondas de sonido (waveform) */
.waveform-animation {
    position: absolute;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 4px;
    z-index: 1;
}

.btn-inventario-record[data-state="grabando"] .waveform-animation {
    display: flex;
}

.wave-bar {
    width: 4px;
    background: var(--bg-white);
    border-radius: 2px;
    animation: waveAnimation 1.2s ease-in-out infinite;
}

.wave-bar:nth-child(1) { height: 20px; animation-delay: 0s; }
.wave-bar:nth-child(2) { height: 35px; animation-delay: 0.1s; }
.wave-bar:nth-child(3) { height: 50px; animation-delay: 0.2s; }
.wave-bar:nth-child(4) { height: 35px; animation-delay: 0.3s; }
.wave-bar:nth-child(5) { height: 20px; animation-delay: 0.4s; }

@keyframes waveAnimation {
    0%, 100% {
        transform: scaleY(0.3);
        opacity: 0.7;
    }
    50% {
        transform: scaleY(1);
        opacity: 1;
    }
}

@keyframes inventarioRecordingPulse {
    0%, 100% {
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2), 0 0 0 0 rgba(255, 204, 0, 0.5);
    }
    50% {
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2), 0 0 0 12px rgba(255, 204, 0, 0);
    }
}

@keyframes inventarioBorderPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
        box-shadow: 0 0 20px rgba(255, 204, 0, 0.6), 0 0 40px rgba(255, 204, 0, 0.4);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.15);
        box-shadow: 0 0 30px rgba(255, 204, 0, 0.8), 0 0 60px rgba(255, 204, 0, 0.6);
    }
}

/* Spinner de procesamiento */
.inventario-processing {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
}

.inventario-processing.hidden {
    display: none;
}

.spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
}

.spinner {
    width: 70px;
    height: 70px;
    border: 6px solid var(--border-light);
    border-top: 6px solid var(--primary-yellow);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.processing-text {
    color: var(--text-medium);
    font-size: 18px;
    font-weight: 600;
    margin-top: var(--spacing-md);
}

/* Aviso de inventario */
.inventory-warning {
    width: 100%;
    max-width: 600px;
    margin-top: var(--spacing-lg);
    padding: var(--spacing-md);
    background-color: #F9FAFB; /* Fondo muy suave */
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--text-medium); /* Texto gris discreto */
    text-align: left;
    line-height: 1.5;
    transition: all 0.5s ease-in-out;
    opacity: 1;
    max-height: 500px;
    overflow: hidden;
}

.inventory-warning.hidden {
    display: block;
    opacity: 0;
    max-height: 0;
    margin-top: 0;
    padding: 0;
    border: 0;
}

.warning-title {
    color: var(--text-dark);
    margin-bottom: var(--spacing-xs);
}

.inventory-warning ul {
    margin-top: var(--spacing-xs);
    padding-left: var(--spacing-lg);
    list-style-type: disc;
}

.inventory-warning li {
    margin-bottom: 4px;
}

.inventory-warning strong {
    font-weight: 600;
    color: var(--text-dark); /* Destacar los números en oscuro */
}

/* Contenedor de resultados */
.inventario-results {
    margin-top: var(--spacing-2xl);
    width: 100%;
}

.inventario-results.hidden {
    display: none;
}

/* Header de resultados */
.inventario-results-header {
    display: grid;
    grid-template-columns: 70% 15% 15%;
    gap: var(--spacing-sm);
    background: #F3F4F6;
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
    font-weight: 600;
    font-size: 14px;
    color: var(--text-dark);
}

.header-col {
    text-align: left;
}

/* Estilos para las nuevas etiquetas de inventario */
.inventario-labels-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    margin-bottom: 10px;
}

.label-movimientos, .label-deshacer {
    font-size: 0.7rem;
    color: #888;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
}

/* Alineación específica para 'Deshacer' sobre el botón */
.label-deshacer {
    width: 60px; /* Ajusta esto según el ancho de tu botón de deshacer */
    text-align: right;
}

.header-cantidad,
.header-stock {
    text-align: center;
}

/* Action Cards */
.inventario-action-cards {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.inventario-action-card-wrapper {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    position: relative;
}

.inventario-action-card {
    display: flex;
    align-items: center;
    flex: 1;
    padding: var(--spacing-xl);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    transition: all 0.3s ease;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.7) 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.inventario-action-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.inventario-action-card.entrada {
    background: linear-gradient(135deg, #D1FAE5 0%, #A7F3D0 100%);
    border-color: #86EFAC;
}

.inventario-action-card.salida {
    background: linear-gradient(135deg, #FEE2E2 0%, #FECACA 100%);
    border-color: #FCA5A5;
}

.inventario-action-card.no-match {
    background: linear-gradient(135deg, #FFF7ED 0%, #FFEDD5 100%);
    border-color: #FDBA74;
}

/* Icono de la card */
.inventario-action-card-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: var(--spacing-lg);
    flex-shrink: 0;
}

.inventario-action-card-icon.entrada {
    background: #10B981;
    color: white;
}

.inventario-action-card-icon.salida {
    background: #EF4444;
    color: white;
}

.inventario-action-card-icon.no-match {
    background: #F97316;
    color: white;
}

.inventario-action-card-icon svg {
    width: 28px;
    height: 28px;
}

.inventario-action-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.inventario-action-card-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.4;
}

.inventario-action-card-details {
    font-size: 14px;
    color: var(--text-medium);
    opacity: 0.8;
    font-weight: 400;
}

.btn-undo-large {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid var(--border-light);
    background: var(--bg-white);
    color: var(--text-dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-undo-large:hover {
    background: var(--bg-soft);
    border-color: var(--text-dark);
    transform: rotate(-180deg) scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-undo-large:active {
    transform: rotate(-180deg) scale(1.05);
}

.btn-undo-large svg {
    width: 24px;
    height: 24px;
}

/* Responsive para inventario */
@media (max-width: 600px) {
    .module-content-title {
        font-size: 28px;
    }
    
    .module-content-subtitle {
        font-size: 16px;
    }
    
    .btn-inventario-record {
        width: 120px;
        height: 120px;
    }
    
    .record-icon-mic-large {
        width: 42px;
        height: 42px;
    }
    
    .spinner {
        width: 60px;
        height: 60px;
        border-width: 5px;
    }
    
    .processing-text {
        font-size: 16px;
    }
    
    .inventario-results-header {
        font-size: 12px;
        padding: var(--spacing-sm) var(--spacing-md);
    }
    
    .inventario-action-card {
        padding: var(--spacing-lg);
    }
    
    .inventario-action-card-icon {
        width: 48px;
        height: 48px;
        margin-right: var(--spacing-md);
    }
    
    .inventario-action-card-icon svg {
        width: 24px;
        height: 24px;
    }
    
    .inventario-action-card-text {
        font-size: 16px;
    }
    
    .inventario-action-card-details {
        font-size: 13px;
    }
    
    .btn-undo-large {
        width: 48px;
        height: 48px;
    }
    
    .btn-undo-large svg {
        width: 20px;
        height: 20px;
    }
}
