/* css/style.css - Versión con números optimizados para pantalla completa */

:root {
    --primary-green: #81C784;
    --dark-green: #388E3C;
    --app-background: #000000;
    --app-surface: #000000;
    --clock-bg: #000000;
    --clock-text: #FFE4B5;
    --accent-color: #979595;
    
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-elevated: 0 4px 8px rgba(0,0,0,0.12);
    
    --margin-side: 10%;
    /* TAMAÑOS OPTIMIZADOS - grandes pero sin cortarse */
    --clock-size-mobile: 6rem;      /* 9rem -> 6rem */
    --clock-size-tablet: 8rem;      /* 14rem -> 8rem */
    --clock-size-desktop: 10rem;    /* 18rem -> 10rem */
    --text-size-base: 18px;
}

/* FUENTES */
/* Importar Google Fonts para fuentes digitales */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;600;700;800;900&family=Share+Tech+Mono&display=swap');

/* Fuentes digitales de Google Fonts */
.clock-font-orbitron {
    font-family: 'Orbitron', monospace !important;
    font-weight: 700; /* Peso más grueso para mejor visibilidad */
}

.clock-font-share-tech {
    font-family: 'Share Tech Mono', monospace !important;
}

/* Mantener Digital-7 para quienes prefieren el clásico */
@font-face {
    font-family: 'Digital-7';
    src: url('https://fonts.cdnfonts.com/css/digital-7');
}

.clock-font-digital-7 {
    font-family: 'Digital-7', monospace !important;
}

/* Fuentes estándar existentes */
.clock-font-roboto { font-family: 'Roboto', sans-serif !important; }
.clock-font-arial { font-family: 'Arial', sans-serif !important; }
.clock-font-helvetica { font-family: 'Helvetica', sans-serif !important; }
.clock-font-georgia { font-family: 'Georgia', serif !important; }
.clock-font-times { font-family: 'Times New Roman', serif !important; }
.clock-font-courier { font-family: 'Courier New', monospace !important; }
.clock-font-verdana { font-family: 'Verdana', sans-serif !important; }
.clock-font-trebuchet { font-family: 'Trebuchet MS', sans-serif !important; }
.clock-font-gill { font-family: 'Gill Sans', sans-serif !important; }

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

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--app-background);
    color: white;
    height: 100vh;
    overflow: hidden;
    font-size: var(--text-size-base);
}

/* PANTALLAS */
.screen {
    display: none;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    background-color: var(--app-surface);
}

.screen.active {
    display: flex;
}

/* Encabezado */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px var(--margin-side);
    background-color: #000000;
    box-shadow: var(--shadow);
    border-bottom: 1px solid #333;
    width: 100%;
    position: relative;
    z-index: 10;
    flex-shrink: 0; /* Evitar que el header se encoja */
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.app-icon {
    font-size: 28px;
}

.app-title {
    font-size: 1.5rem;
    font-weight: 500;
}

.pinyin {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
}

.header-center {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    justify-content: center;
}

.event-title {
    font-size: 1.4rem;
    font-weight: 500;
}

/* Botones */
.icon-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 12px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    min-width: 48px;
    min-height: 48px;
    color: white;
    z-index: 20;
    position: relative;
}

.icon-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.icon-btn.small {
    font-size: 18px;
    padding: 8px;
}

.back-btn {
    font-weight: bold;
    font-size: 20px;
    color: white !important;
    background-color: rgba(255, 255, 255, 0.1);
}

.back-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.btn {
    padding: 14px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    background-color: #333;
    color: white;
    min-height: 50px;
    flex: 1;
    max-width: 200px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn:hover {
    background-color: #555;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn.primary {
    background-color: var(--primary-green);
}

.btn.primary:hover {
    background-color: var(--dark-green);
}

/* Menú principal */
.menu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    padding: 30px var(--margin-side);
    flex: 1;
    align-content: center;
    width: 100%;
}

.menu-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #333;
    border: none;
    border-radius: 16px;
    padding: 35px 20px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: var(--shadow);
    aspect-ratio: 1;
    -webkit-tap-highlight-color: transparent;
}

.menu-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-elevated);
    background-color: #444;
}

.menu-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.menu-label {
    font-size: 1.2rem;
    font-weight: 500;
}

.menu-card * {
    pointer-events: none;
}

.btn, .icon-btn {
    pointer-events: auto;
}

/* CONTENEDOR DE RELOJ - NÚMEROS OPTIMIZADOS */
.clock-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 20px var(--margin-side); /* Reducido padding vertical */
    background-color: var(--clock-bg);
    color: var(--clock-text);
    width: 100%;
    min-height: 0; /* Permitir que se encoja si es necesario */
}

.clock-display {
    font-size: var(--clock-size-mobile);
    font-weight: 700;
    letter-spacing: 4px;
    margin-bottom: 30px; /* Reducido margen */
    text-align: center;
    width: 100%;
    line-height: 1;
    padding: 10px 0;
    transition: color 0.3s ease, background-color 0.3s ease;
    border-radius: 12px;
    white-space: nowrap; /* Evitar salto de línea */
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Controles */
.controls {
    display: flex;
    gap: 15px;
    margin-top: 20px; /* Reducido margen */
    width: 100%;
    max-width: 500px;
    justify-content: center;
    flex-wrap: nowrap;
    flex-shrink: 0; /* Evitar que los controles se encojan */
}

.timer-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px; /* Reducido gap */
    width: 100%;
    max-width: 500px;
    flex-shrink: 0;
}

/* Select y inputs */
select {
    padding: 15px 20px;
    border-radius: 8px;
    border: 1px solid #333;
    background-color: #222;
    font-size: 1.1rem;
    width: 100%;
    color: white;
    min-height: 50px;
}

.custom-input {
    display: flex;
    gap: 15px;
    width: 100%;
    max-width: 500px;
    margin-top: 20px; /* Reducido margen */
    align-items: center;
    flex-shrink: 0;
}

.custom-input input {
    flex: 1;
    padding: 15px 20px;
    border-radius: 8px;
    border: 1px solid #333;
    font-size: 1.1rem;
    background-color: #222;
    color: white;
    min-height: 50px;
}

/* Hora objetivo */
.target-time {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 20px; /* Reducido margen */
    color: var(--accent-color);
    font-size: 1.2rem;
    flex-shrink: 0;
}

.target-time-text {
    opacity: 0.8;
}

/* Edición de título */
.edit-container {
    display: flex;
    gap: 15px;
    padding: 20px var(--margin-side);
    background-color: #000000;
    border-top: 1px solid #333;
    align-items: center;
    width: 100%;
    flex-shrink: 0;
}

.edit-container input {
    flex: 1;
    padding: 15px 20px;
    border-radius: 8px;
    border: 1px solid #333;
    font-size: 1.1rem;
    background-color: #222;
    color: white;
    min-height: 50px;
}

.hidden {
    display: none !important;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 0 var(--margin-side);
}

.modal-content {
    background-color: #000000;
    border-radius: 12px;
    padding: 30px;
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-elevated);
    border: 1px solid #333;
}

.modal-content h3 {
    margin-bottom: 25px;
    font-weight: 500;
    font-size: 1.4rem;
    text-align: center;
}

.modal-content input[type="time"] {
    width: 100%;
    padding: 15px 20px;
    border-radius: 8px;
    border: 1px solid #333;
    font-size: 1.2rem;
    margin-bottom: 25px;
    background-color: #222;
    color: white;
    min-height: 50px;
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
}

/* Configuración */
.settings-container {
    padding: 30px var(--margin-side);
    flex: 1;
    overflow-y: auto;
    width: 100%;
}

.setting-group {
    margin-bottom: 35px;
}

.setting-group h3 {
    margin-bottom: 15px;
    font-weight: 500;
    font-size: 1.3rem;
}

.setting-group input[type="color"] {
    width: 100%;
    height: 60px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background-color: #222;
}

.setting-group select {
    background-color: #222;
    border: 1px solid #333;
    font-size: 1.1rem;
}

.settings-actions {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid #333;
}

.settings-actions .btn {
    width: 100%;
    font-size: 1.2rem;
    padding: 18px 24px;
    max-width: 100%;
}

/* Animación de alarma */
@keyframes blink-alarm {
    0%, 50% {
        color: var(--clock-text);
        background-color: var(--clock-bg);
    }
    51%, 100% {
        color: #ff4444;
        background-color: #1a0000;
    }
}

.blinking-alarm {
    animation: blink-alarm 1s infinite;
}

.alarm-active {
    box-shadow: 0 0 30px rgba(255, 68, 68, 0.6);
}

/* RESPONSIVE CON NÚMEROS OPTIMIZADOS */
@media (min-width: 768px) {
    .clock-display {
        font-size: var(--clock-size-tablet);
        letter-spacing: 6px;
        margin-bottom: 40px;
    }
    
    .menu-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 30px;
        padding: 40px var(--margin-side);
    }
    
    .menu-card {
        padding: 50px 30px;
    }
    
    .menu-icon {
        font-size: 5rem;
    }
    
    .menu-label {
        font-size: 1.4rem;
    }
    
    .controls {
        max-width: 90%;
        gap: 15px;
        margin-top: 40px;
        padding: 0 5%;
    }
    
    .timer-controls {
        max-width: 90%;
        padding: 0 5%;
    }
    
    .custom-input {
        max-width: 90%;
        gap: 12px;
        padding: 0 5%;
    }
    
    .btn {
        padding: 14px 16px;
        font-size: 1.1rem;
        min-height: 50px;
        max-width: 160px;
        min-width: 120px;
    }
    
    .controls:has(.btn:nth-child(2)):not(:has(.btn:nth-child(3))) {
        max-width: 350px;
    }
    
    .controls:has(.btn:nth-child(2)):not(:has(.btn:nth-child(3))) .btn {
        max-width: 150px;
    }
    
    .controls:has(.btn:nth-child(3)) {
        max-width: 480px;
        gap: 12px;
    }
    
    .controls:has(.btn:nth-child(3)) .btn {
        max-width: 130px;
        font-size: 1rem;
        padding: 12px 14px;
    }
    
    select {
        font-size: 1.1rem;
        padding: 14px 16px;
    }
    
    .custom-input input {
        max-width: 65%;
        min-width: 200px;
    }
    
    .custom-input .btn {
        max-width: 30%;
        min-width: 100px;
    }
    
    .settings-actions {
        flex-direction: row;
        justify-content: space-between;
        gap: 20px;
    }
    
    .settings-actions .btn {
        max-width: 48%;
        padding: 18px 20px;
    }
}

@media (min-width: 1200px) {
    .clock-display {
        font-size: var(--clock-size-desktop);
        letter-spacing: 8px;
    }
    
    .controls {
        max-width: 600px;
        gap: 20px;
    }
    
    .timer-controls {
        max-width: 600px;
    }
    
    .custom-input {
        max-width: 600px;
    }
    
    .btn {
        font-size: 1.2rem;
        padding: 16px 20px;
        max-width: 180px;
    }
}

/* AJUSTES PARA MÓVILES CON NÚMEROS OPTIMIZADOS */
@media (max-width: 767px) and (max-aspect-ratio: 1/1) {
    :root {
        --margin-side: 5%;
    }
    
    .clock-display {
        font-size: 5rem; /* 7rem -> 5rem */
        letter-spacing: 3px;
        margin-bottom: 30px;
    }
    
    .menu-grid {
        grid-template-columns: 1fr 1fr;
        gap: 20px;
        padding: 20px var(--margin-side);
    }
    
    .menu-card {
        padding: 25px 15px;
    }
    
    .menu-icon {
        font-size: 3rem;
    }
    
    .controls {
        flex-direction: column;
        gap: 15px;
        margin-top: 30px;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .btn {
        max-width: 100%;
        width: 100%;
    }
}

/* AJUSTES PARA LANDSCAPE ESTRECHO CON NÚMEROS OPTIMIZADOS */
@media (max-height: 500px) and (orientation: landscape) {
    .clock-display {
        font-size: 4rem; /* 6rem -> 4rem */
        margin-bottom: 15px;
        letter-spacing: 2px;
    }
    
    .clock-container {
        padding: 10px var(--margin-side);
    }
    
    .controls {
        margin-top: 15px;
        max-width: 98%;
        gap: 8px;
        padding: 0 1%;
    }
    
    .btn {
        padding: 8px 10px;
        font-size: 0.9rem;
        min-height: 40px;
        max-width: 120px;
    }
    
    .controls:has(.btn:nth-child(3)) .btn {
        max-width: 110px;
        font-size: 0.85rem;
        padding: 6px 8px;
    }
    
    .target-time {
        margin-top: 10px;
        font-size: 1rem;
    }
    
    .menu-grid {
        padding: 10px var(--margin-side);
        gap: 8px;
    }
    
    .menu-card {
        padding: 15px 10px;
    }
    
    .menu-icon {
        font-size: 2rem;
        margin-bottom: 5px;
    }
}

/* AJUSTES ESPECIALES PARA ASEGURAR QUE LOS NÚMEROS NO SE CORTEN */
.clock-display {
    /* Propiedades críticas para evitar corte */
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    min-width: 0;
    flex-shrink: 1;
}

/* Para pantallas muy pequeñas, usar viewport units */
@media (max-width: 380px) {
    .clock-display {
        font-size: 4.5rem;
        letter-spacing: 2px;
    }
}

/* Estilos para el toggle switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #333;
    transition: .4s;
    border-radius: 34px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: var(--primary-green);
}

input:checked + .toggle-slider:before {
    transform: translateX(26px);
}
