* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #6b0f1a; /* sólido burdeos */
    color: #333;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    touch-action: manipulation;
    scroll-behavior: smooth;
}

.container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background: #ffffff;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

header {
    background: #6b0f1a; /* sólido burdeos */
    color: white;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.header-logo {
    height: 50px;
    width: auto;
    object-fit: contain;
}

header h1 {
    font-size: 2.5em;
    font-weight: 300;
    margin-bottom: 10px;
    letter-spacing: 2px;
}

.wine-info {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9em;
    display: inline-block;
}

main {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

/* Pantalla de configuración inicial */
.setup-screen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.setup-container {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    width: 100%;
    text-align: center;
}

.setup-container h2 {
    color: #6b0f1a;
    margin-bottom: 30px;
    font-size: 1.8em;
}

.qr-section, .catador-section {
    margin-bottom: 20px;
}

.setup-btn {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    margin: 10px 0;
    transition: all 0.3s ease;
}

.setup-btn:not(.secondary) {
    background: #6b0f1a; /* sólido burdeos */
    color: white;
}

.setup-btn.secondary {
    background: #f3f4f6;
    color: #6b0f1a;
    border: 2px solid #6b0f1a;
}

.setup-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(107, 15, 26, 0.3);
}

.setup-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.manual-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1.1em;
    text-align: center;
    text-transform: uppercase;
    margin: 10px 0;
    transition: border-color 0.3s ease;
}

.manual-input:focus {
    outline: none;
    border-color: #6b0f1a;
}

.catador-select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1.1em;
    margin: 10px 0;
    background: white;
}

.help-text {
    color: #6b7280;
    font-size: 0.9em;
    margin: 15px 0 5px 0;
}

#qr-reader {
    margin: 20px 0;
    border-radius: 8px;
    overflow: hidden;
}

#wine-name {
    text-align: center;
    margin-bottom: 30px;
    color: #6b0f1a;
    font-size: 1.4em;
    font-weight: 500;
}

.evaluation-container {
    display: flex;
    flex-direction: column;
    gap: 25px;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slider-container {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #6b0f1a;
}

.slider-label {
    font-weight: 600;
    color: #6b0f1a;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.slider-wrapper {
    position: relative;
    margin: 15px 0;
}

.range-slider {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #ddd;
    outline: none;
    opacity: 0.8;
    transition: opacity 0.2s;
    -webkit-appearance: none;
    appearance: none;
    touch-action: none;
    cursor: pointer;
}

.range-slider:hover {
    opacity: 1;
}

.range-slider::-webkit-slider-thumb {
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #a4133c; /* sólido acento */
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s;
    touch-action: manipulation;
}

.range-slider::-webkit-slider-thumb:hover,
.range-slider::-webkit-slider-thumb:active {
    transform: scale(1.1);
}

.range-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #a4133c; /* sólido acento */
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    border: none;
    touch-action: manipulation;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.85em;
    color: #666;
}

.slider-value {
    text-align: center;
    margin-top: 10px;
    font-weight: bold;
    font-size: 1.2em;
    color: #6b0f1a;
    background: rgba(107, 15, 26, 0.1);
    padding: 8px;
    border-radius: 6px;
}

.observation-text {
    width: 100%;
    min-height: 80px;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1em;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s ease;
}

.observation-text:focus {
    outline: none;
    border-color: #6b0f1a;
    background-color: rgba(107, 15, 26, 0.05);
}

footer {
    padding: 20px;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

.navigation-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.nav-btn {
    padding: 15px 25px;
    border: none;
    border-radius: 25px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 140px;
    text-transform: none;
}

.nav-btn:not(.finish-btn) {
    background: #6b0f1a; /* sólido burdeos */
    color: white;
    box-shadow: 0 4px 12px rgba(107, 15, 26, 0.3);
}

.nav-btn:not(.finish-btn):hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(107, 15, 26, 0.4);
}

.finish-btn {
    background: #28a745; /* sólido verde */
    color: white;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.finish-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(40, 167, 69, 0.4);
}

.install-btn {
    background: #6b0f1a !important; /* sólido burdeos */
    color: white !important;
    box-shadow: 0 4px 12px rgba(107, 15, 26, 0.3) !important;
    border: 2px solid rgba(255, 255, 255, 0.2) !important;
}

.install-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 16px rgba(107, 15, 26, 0.4) !important;
}

.nav-btn:active {
    transform: translateY(0);
}

/* Responsive Design */
@media (max-width: 480px) {
    .container {
        max-width: 100%;
        margin: 0;
    }
    
    header {
        padding: 12px 10px;
    }
    
    .header-logo {
        height: 40px;
    }
    
    header h1 {
        font-size: 1.8em;
        margin-bottom: 8px;
    }
    
    .wine-info {
        font-size: 0.85em;
        padding: 6px 12px;
    }
    
    main {
        padding: 10px;
    }
    
    #wine-name {
        font-size: 1.2em;
        margin-bottom: 20px;
    }
    
    .evaluation-container {
        gap: 15px;
    }
    
    .slider-container {
        padding: 12px;
        margin: 0 5px;
        border-radius: 8px;
    }
    
    .slider-label {
        font-size: 1em;
        margin-bottom: 10px;
    }
    
    .range-slider {
        height: 10px;
    }
    
    .range-slider::-webkit-slider-thumb {
        width: 28px;
        height: 28px;
    }
    
    .slider-labels {
        font-size: 0.8em;
        margin-top: 5px;
    }
    
    .slider-value {
        font-size: 1.1em;
        padding: 6px;
        margin-top: 8px;
    }
    
    footer {
        padding: 15px 10px;
    }
    
    .navigation-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .nav-btn {
        min-width: auto;
        width: 100%;
        padding: 12px 20px;
        font-size: 1em;
    }
}

/* Extra small screens */
@media (max-width: 360px) {
    header {
        padding: 10px 8px;
    }
    
    .header-logo {
        height: 35px;
    }
    
    header h1 {
        font-size: 1.6em;
    }
    
    main {
        padding: 8px;
    }
    
    .slider-container {
        padding: 10px;
        margin: 0 2px;
    }
    
    .slider-label {
        font-size: 0.95em;
    }
    
    .range-slider::-webkit-slider-thumb {
        width: 26px;
        height: 26px;
    }
    
    footer {
        padding: 12px 8px;
    }
}

/* Landscape orientation adjustments */
@media (orientation: landscape) and (max-height: 600px) {
    header h1 {
        font-size: 1.8em;
        margin-bottom: 5px;
    }
    
    header {
        padding: 15px;
    }
    
    main {
        padding: 15px;
    }
    
    .evaluation-container {
        gap: 15px;
    }
    
    .slider-container {
        padding: 15px;
    }
}

/* Estilos adicionales para input manual */
.manual-input-section {
    margin-top: 15px;
}

.manual-input {
    width: 100%;
    max-width: 200px;
    padding: 12px;
    border: 2px solid #a4133c;
    border-radius: 8px;
    font-size: 18px;
    text-align: center;
    text-transform: uppercase;
    font-weight: bold;
    background: white;
    margin-bottom: 10px;
}

.manual-input:focus {
    outline: none;
    border-color: #6b0f1a;
    box-shadow: 0 0 10px rgba(164, 19, 60, 0.3);
}

.help-text {
    color: #6b7280;
    font-size: 14px;
    margin: 15px 0 10px 0;
    font-style: italic;
}

#qr-reader {
    max-width: 300px;
    margin: 15px auto;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Animación para destacar el input manual */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(164, 19, 60, 0.7);
        border-color: #a4133c;
    }
    50% {
        box-shadow: 0 0 0 10px rgba(164, 19, 60, 0.3);
        border-color: #6b0f1a;
    }
    100% {
        box-shadow: 0 0 0 0 rgba(164, 19, 60, 0);
        border-color: #a4133c;
    }
}