/* =============================================
   REGISTRO CSS - TEMA CAFETERÍA RESPONSIVE
   ============================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    /* Fondo cálido que recuerda al café con leche */
    background: linear-gradient(135deg, #f3e5ab, #e6c9a8, #d9a066);
    background-attachment: fixed;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #4b3832;
    padding: 20px;
}

/* =============================================
   CONTENEDOR PRINCIPAL
   ============================================= */
.contenedor {
    width: 100%;
    max-width: 480px;
    padding: 35px 30px;
    background: #fffdf8;
    border-radius: 15px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
    text-align: center;
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
    position: relative;
    overflow: hidden;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Ícono decorativo de café */
.contenedor::before {
    content: "☕";
    font-size: clamp(2.8rem, 7vw, 3.8rem);
    color: #e0c9a6;
    position: absolute;
    top: -25px;
    right: 15px;
    opacity: 0.2;
}

.contenedor:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25);
}

/* =============================================
   TÍTULO
   ============================================= */
h2 {
    margin: 0 0 25px;
    color: #6b4d3d;
    font-size: clamp(1.6rem, 5vw, 2.2rem);
    font-weight: 700;
    letter-spacing: 1px;
}

/* =============================================
   FORMULARIO
   ============================================= */
form {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Etiquetas */
label {
    display: block;
    text-align: left;
    margin-bottom: 8px;
    font-weight: bold;
    color: #5d4037;
    font-size: clamp(0.9rem, 2.5vw, 1rem);
}

/* Inputs */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"] {
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 18px;
    border: 1px solid #d3c4b1;
    border-radius: 8px;
    font-size: clamp(0.9rem, 2.5vw, 1rem);
    background-color: #fcf9f5;
    transition: all 0.3s ease-in-out;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 48px;
}

input::placeholder {
    color: #a1887f;
}

input:focus {
    border-color: #a97452;
    box-shadow: 0 0 8px rgba(169, 116, 82, 0.4);
    outline: none;
}

input:disabled {
    background-color: #f0f0f0;
    cursor: not-allowed;
    opacity: 0.7;
}

input.error {
    border-color: #c62828;
    animation: shake 0.3s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* =============================================
   BOTÓN
   ============================================= */
button[type="submit"] {
    background: linear-gradient(135deg, #8c5e4a, #6b4d3d);
    color: #fff;
    border: none;
    padding: 14px;
    border-radius: 8px;
    font-size: clamp(1rem, 2.5vw, 1.1rem);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease-in-out;
    letter-spacing: 1px;
    text-transform: uppercase;
    min-height: 52px;
    margin-bottom: 18px;
}

button[type="submit"]:hover {
    background: linear-gradient(135deg, #a97452, #8c5e4a);
    transform: scale(1.03);
}

button[type="submit"]:active {
    transform: scale(0.97);
}

button[type="submit"]:focus {
    outline: 2px solid #a97452;
    outline-offset: 2px;
}

button[type="submit"]:disabled {
    background: linear-gradient(135deg, #bcaaa4, #a1887f);
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
}

/* Spinner de carga */
button[type="submit"]:disabled::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    top: 50%;
    right: 15px;
    margin-top: -9px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* =============================================
   ENLACES Y TEXTO
   ============================================= */
p {
    margin-top: 18px;
    color: #5d4037;
    font-size: clamp(0.85rem, 2vw, 0.95rem);
    line-height: 1.5;
}

p a {
    color: #8c5e4a;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s;
    padding: 2px 4px;
}

p a:hover {
    color: #d2691e;
    text-decoration: underline;
}

p a:focus {
    outline: 2px solid #8c5e4a;
    outline-offset: 2px;
    border-radius: 2px;
}

/* =============================================
   MENSAJES DE ERROR/ÉXITO
   ============================================= */
.mensaje {
    padding: 15px;
    margin-bottom: 18px;
    border-radius: 8px;
    font-weight: bold;
    line-height: 1.4;
    font-size: clamp(0.85rem, 2vw, 0.95rem);
    text-align: left;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.exito {
    background-color: #e6f7e9;
    color: #27793d;
    border: 1px solid #c8e6c9;
    border-left: 4px solid #4caf50;
}

.error {
    background-color: #fde8e8;
    color: #993333;
    border: 1px solid #f6caca;
    border-left: 4px solid #c62828;
}

.mensaje a {
    color: inherit;
    text-decoration: underline;
}

/* =============================================
   VALIDACIÓN EN TIEMPO REAL
   ============================================= */
.campo-valido {
    border-color: #4caf50 !important;
}

.campo-invalido {
    border-color: #c62828 !important;
}

.helper-text {
    display: block;
    font-size: clamp(0.75rem, 2vw, 0.85rem);
    color: #6c6c6c;
    margin-top: -14px;
    margin-bottom: 14px;
    text-align: left;
}

.helper-text.error {
    color: #c62828;
}

.helper-text.success {
    color: #4caf50;
}

/* =============================================
   BOTÓN VOLVER
   ============================================= */
.volver-btn {
    display: inline-block;
    background: linear-gradient(135deg, #d9a066, #b07d52);
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: clamp(0.9rem, 2.5vw, 1rem);
    font-weight: bold;
    text-decoration: none;
    transition: all 0.3s ease-in-out;
    margin-top: 12px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.volver-btn:hover {
    background: linear-gradient(135deg, #f1c27d, #d9a066);
    transform: scale(1.05);
}

.volver-btn:active {
    transform: scale(0.97);
}

.volver-btn:focus {
    outline: 2px solid #d9a066;
    outline-offset: 2px;
}

/* =============================================
   RESPONSIVE - TABLETS
   ============================================= */
@media (max-width: 768px) {
    body {
        padding: 15px;
    }

    .contenedor {
        max-width: 520px;
        padding: 30px 25px;
    }

    .contenedor::before {
        top: -22px;
        right: 12px;
    }

    h2 {
        margin-bottom: 22px;
    }

    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    input[type="number"] {
        margin-bottom: 16px;
        padding: 11px 14px;
    }

    button[type="submit"] {
        padding: 13px;
    }
}

/* =============================================
   RESPONSIVE - MÓVILES
   ============================================= */
@media (max-width: 480px) {
    body {
        padding: 12px;
        align-items: flex-start;
        padding-top: 30px;
    }

    .contenedor {
        width: 100%;
        max-width: 100%;
        padding: 28px 22px;
        border-radius: 12px;
    }

    .contenedor::before {
        font-size: 2.8rem;
        top: -20px;
        right: 10px;
    }

    h2 {
        margin-bottom: 20px;
        letter-spacing: 0.5px;
    }

    label {
        margin-bottom: 6px;
    }

    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    input[type="number"] {
        padding: 11px 13px;
        margin-bottom: 16px;
        border-radius: 7px;
    }

    button[type="submit"] {
        padding: 13px;
        border-radius: 7px;
        min-height: 48px;
    }

    .mensaje {
        padding: 12px;
        margin-bottom: 16px;
    }

    p {
        margin-top: 16px;
    }

    .volver-btn {
        width: 100%;
        margin-top: 10px;
        padding: 11px 18px;
    }

    .helper-text {
        margin-top: -12px;
        margin-bottom: 12px;
    }
}

/* =============================================
   RESPONSIVE - MÓVILES PEQUEÑOS
   ============================================= */
@media (max-width: 360px) {
    body {
        padding: 10px;
        padding-top: 20px;
    }

    .contenedor {
        padding: 24px 18px;
        border-radius: 10px;
    }

    .contenedor::before {
        font-size: 2.4rem;
        top: -18px;
        right: 8px;
    }

    h2 {
        margin-bottom: 18px;
        font-size: 1.5rem;
    }

    label {
        font-size: 0.85rem;
    }

    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    input[type="number"] {
        padding: 10px 12px;
        margin-bottom: 14px;
        font-size: 14px;
        min-height: 44px;
    }

    button[type="submit"] {
        padding: 12px;
        font-size: 15px;
        min-height: 46px;
    }

    .mensaje {
        padding: 10px 12px;
        font-size: 0.8rem;
    }

    .volver-btn {
        padding: 10px 16px;
        font-size: 0.9rem;
    }

    .helper-text {
        font-size: 0.7rem;
    }
}

/* =============================================
   LANDSCAPE MODE EN MÓVILES
   ============================================= */
@media (max-width: 768px) and (orientation: landscape) {
    body {
        padding: 10px;
        align-items: center;
    }

    .contenedor {
        padding: 22px 28px;
        max-width: 600px;
    }

    h2 {
        margin-bottom: 15px;
        font-size: 1.6rem;
    }

    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    input[type="number"] {
        margin-bottom: 12px;
        padding: 9px 12px;
    }

    button[type="submit"] {
        padding: 11px;
        min-height: 44px;
    }

    .mensaje {
        padding: 10px 15px;
        margin-bottom: 12px;
    }
}

/* =============================================
   OPTIMIZACIÓN PARA PANTALLAS TÁCTILES
   ============================================= */
@media (hover: none) and (pointer: coarse) {
    .contenedor:hover {
        transform: none;
    }

    button[type="submit"]:active {
        transform: scale(0.96);
    }

    .volver-btn:active {
        transform: scale(0.95);
    }

    p a:active {
        color: #d2691e;
        background-color: rgba(210, 105, 30, 0.1);
    }

    /* Áreas táctiles más grandes */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    input[type="number"] {
        min-height: 48px;
    }

    p a {
        padding: 6px 10px;
        margin: -6px -10px;
    }
}

/* =============================================
   MEJORAS DE ACCESIBILIDAD
   ============================================= */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .contenedor:hover,
    button[type="submit"]:hover,
    .volver-btn:hover {
        transform: none;
    }
}

/* =============================================
   ALTO CONTRASTE
   ============================================= */
@media (prefers-contrast: high) {
    .contenedor {
        border: 2px solid #6b4d3d;
    }

    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    input[type="number"] {
        border-width: 2px;
    }

    input:focus {
        border-width: 3px;
    }

    button[type="submit"],
    .volver-btn {
        border: 2px solid #4b3832;
    }

    .mensaje {
        border-width: 2px;
    }
}

/* =============================================
   SAFE AREA PARA NOTCH (iPhone X+)
   ============================================= */
@supports (padding: max(0px)) {
    body {
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
        padding-top: max(20px, env(safe-area-inset-top));
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
}

/* =============================================
   GRID LAYOUT PARA CAMPOS (OPCIONAL)
   ============================================= */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0 15px;
}

.form-row input {
    width: 100%;
}

@media (max-width: 480px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

/* =============================================
   PRINT STYLES
   ============================================= */
@media print {
    body {
        background: white;
        padding: 0;
    }

    .contenedor {
        box-shadow: none;
        border: 1px solid #000;
    }

    .contenedor::before,
    .volver-btn,
    button[type="submit"] {
        display: none;
    }

    input {
        border: 1px solid #000;
    }
}

/* =============================================
   MODO OSCURO (OPCIONAL)
   ============================================= */
@media (prefers-color-scheme: dark) {
    /* Si decides implementar modo oscuro
    body {
        background: linear-gradient(135deg, #3e2723, #5d4037, #795548);
    }

    .contenedor {
        background: #4e342e;
        color: #efebe9;
    }

    h2 {
        color: #d7ccc8;
    }

    label {
        color: #bcaaa4;
    }

    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    input[type="number"] {
        background: #3e2723;
        color: #efebe9;
        border-color: #6d4c41;
    }
    */
}

/* =============================================
   FIN DEL ARCHIVO - TOTALMENTE RESPONSIVE
   ============================================= */