/* ------------ General Styles ------------ */
html, body {
    width: 100%;
    margin: 0;
    padding: 0;
    min-height: 100dvh;
    min-width: 100vw;
}
body {
    font-family: 'Arial', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f0f0f0;
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

#app {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

/* Asegurate que todo use border-box */
*, *::before, *::after {
    box-sizing: border-box;
}

/* ------------ Layout ----------------*/
.layout {
    display: flex;
    flex: 1 1 auto;
    min-height: auto;
}

main {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 20px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

/* ------------ Header ----------------*/
header {
    position: relative;
    background-color: #333;
    color: white;
    padding: 20px 0;
    font-size: 20px;
    font-weight: bold;
    letter-spacing: 1px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ------------ Botón Hamburguesa ----------------*/
.hamburger-btn {
    display: none;
    background: transparent !important; /* Fuerza transparencia */
    border: none;
    color: white;
    font-size: 24px;
    padding: 0 20px;
    cursor: pointer;
    order: 2;
    transition: opacity 0.2s ease; /* Transición suave */
}

.hamburger-btn:hover {
    opacity: 0.8; /* Efecto sutil al pasar el mouse */
    background: transparent !important;
}

.hamburger-btn:active {
    transform: scale(0.95); /* Feedback al hacer click */
}

.header-icon {
    margin: 0 20px;
    font-size: 22px;
    color: white;
    text-decoration: none;
}

.header-title {
    flex: 1;
    text-align: center;
}

/* ------------ Footer ----------------*/
footer {
    box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.2);
    background-color: #333;
    color: white;
    text-align: center;
    font-size: 14px;
    margin-top: auto;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0; 
}


footer a {
    color: #FFD700;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* ------------ Navegación ----------------*/
.sidebar {
    width: auto;
    background-color: #444;
    color: white;
    padding: 20px 0;
    height: auto;
}

.sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar li {
    margin: 10px 0;
}

.sidebar a {
    color: white;
    text-decoration: none;
    display: block;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 0.5px;
    transition: background-color 0.2s ease, padding-left 0.2s ease;
}

.sidebar a:hover {
    background-color: #6200ea;
    padding-left: 28px;
}

/* ------------ Títulos ----------------*/
h1 {
    font-size: 1.8em;
    color: #333;
    text-align: center;
    margin-bottom: 20px;
}

/* ------------ Contenedores ----------------*/
.register-container,
.dashboard-container,
.login-container {
    width: 90%;
    margin: 10px 10px;
    padding: 10px;
    max-width: min(600px, 100%);
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-height: fit-content;
    align-self: center;
    height: auto;  
}

.main-content {
    flex: 1;
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    max-height: fit-content;
}

.timbres-cards-container {
    /* margin: 10px 10px; */
    background-color: white;
    border-radius: 8px;
    /* box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); */
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-height: fit-content;
}

.timbre-card {
    margin: 10px 10px;
    background-color: white;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.timbre-card h3 {
    margin: 0;
    color: #333;
}

.timbre-card p {
    margin: 0;
    font-size: 15px;
    color: #555;
}

#add-timbre {
    margin-top: 10px;
    align-self: center;
}

/* ------------ Botones ----------------*/
button {
    padding: 10px 10px;
    font-size: 16px;
    background-color: #03dac5;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease-in-out;
}


button:hover {
    background-color: #018786;
    transform: scale(1.05);
}

.add-button-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ------------ Formularios ----------------*/
form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

form input {
    padding: 10px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

form button {
    width: auto;
}

/* ------------ Tablas ----------------*/
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

table th,
table td {
    padding: 12px 15px;
    border: 1px solid #ddd;
    text-align: center;
    vertical-align: middle;
}

table th {
    background-color: #007BFF;
    color: white;
    text-transform: uppercase;
    font-size: 0.9em;
}

table tr:nth-child(even) {
    background-color: #f9f9f9;
}

table tr:hover {
    background-color: #f1f1f1;
}

/* ------------ QR Code ----------------*/
.qr-image-container {
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.qr-image-container img {
    width: 100%;
    max-width: 200px;
}

/* ------------ Errores ----------------*/
.error-message {
    color: red;
    font-size: 14px;
    margin-top: 10px;
}

/* ------------ Responsive ----------------*/

/* Nueva media query para pantallas muy pequeñas */
@media (max-width: 400px) {

    .register-container,
    .login-container,
    .dashboard-container,
    .timbres-cards-container {
        max-width: min(400px, 100%);
        width: 100%;
        margin: 5px 0;
    }
    
    .sidebar {
        width: 100%;
        padding: 10px 0;
    }
    
    .sidebar a {
        padding: 8px 12px;
        font-size: 14px;
        letter-spacing: 0.3px;
    }
    
    button {
        padding: 6px 8px;
        font-size: 12px;
    }
    
    .header-title {
        font-size: 16px;
        letter-spacing: 0.5px;
    }
    
    .header-icon {
        margin: 0 10px;
        font-size: 18px;
    }
    
    form input {
        padding: 8px;
        font-size: 14px;
    }
    
    .timbre-card {
        padding: 6px;
        gap: 6px;
    }
    
    .timbre-card p {
        font-size: 13px;
    }
    .qr-image-container img {
        width: 100%;
        max-width: 80px;
    }
    .layout {
        flex-direction: column; /* Sidebar arriba en móviles */
    }
    
}

/* ------------ Sidebar Mobile ----------------*/
@media (max-width: 500px) {
    .hamburger-btn {
        display: block;
    }
    
    .sidebar {
        position: fixed;
        top: 0;
        right: -100%;
        width: 70%;
        height: 100%;
        background: #444;
        z-index: 1000;
        transition: right 0.3s ease;
        padding-top: 60px;
    }
    
    .sidebar.active {
        right: 0;
    }
    
    .sidebar ul {
        flex-direction: column;
    }
    
    .sidebar a {
        padding: 15px 20px;
    }
    
    /* Overlay para cerrar el menú */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
}

/* Añadir estas propiedades al final para mejorar el comportamiento flex */
.main-content {
    align-items: flex-start;
}

.dashboard-container,
.timbres-cards-container {
    flex-shrink: 1;
    min-width: 0;
}
/* --- Opciones modernas estilo Material: una sola línea --- */

.message-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.message-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #ddd;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    font-size: 16px;
    color: #333;
}

/* Hover */
.message-option:hover {
    background-color: #f5ffff;
    border-color: #03dac5;
    box-shadow: 0 2px 6px rgba(0,0,0,0.10);
}

/* Ocultar radio original */
.message-option input[type="radio"] {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #777;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    transition: border-color 0.2s ease;
}

/* Punto interno cuando está seleccionado */
.message-option input[type="radio"]:checked {
    border-color: #03dac5;
}

.message-option input[type="radio"]:checked::before {
    content: "";
    width: 10px;
    height: 10px;
    background: #03dac5;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
}

/* Línea resaltada cuando está seleccionada */
.message-option input[type="radio"]:checked + span {
    font-weight: bold;
    color: #03dac5;
}

.timbre-main {
    display: flex;
    flex-direction: column;  /* radios arriba, botón abajo */
    align-items: center;     /* centrado horizontal */
}

.message-selector {
    max-width: 600px;
    width: 100%;
}

.timbre-main #sendNotification {
    width: 100%;
    max-width: 600px;   /* igual que la caja de opciones */
    margin-top: 20px;
    padding: 20px;
    border-radius: 8px;
}

#customMessage {
    display: none;
    margin-top: 12px;
    padding: 12px;
    font-size: 15px;
    border-radius: 6px;
    border: 1px solid #ccc;
    resize: vertical;
    width: 100%;
    max-width: 600px;
    background: #fff;
}

.message-selector h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
    text-align: center;
    margin-bottom: 25px;
    letter-spacing: -0.3px;

    background: #fff;
    padding: 12px 20px;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.no-terminals-message {
    max-width: 600px;
    margin: 20px auto 0 auto;
    padding: 14px 18px;
    background: #fff;
    border-radius: 10px;
    border: 1px solid #eee;
    text-align: center;
    font-size: 14px;
    color: #555;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}


body.terminal-mode {
  background: #000 !important;
  color: #fff;
}


body.terminal-mode main,
body.terminal-mode #app {
  background: #000 !important;
}

/* =========================
   Timbre Splash (Modo Terminal)
   ========================= */

#timbre-splash {
  position: fixed;
  inset: 0;
  z-index: 20000;          /* arriba de blackout (9999) y sidebar (1000) */
  display: none;           /* lo prende el JS */
  align-items: center;
  justify-content: center;
  text-align: center;

  /* rojo/amarillo */
  background: linear-gradient(135deg, #ff0000 0%, #ffd400 100%);

  /* evitar scroll/gestos raros */
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

#timbre-splash .timbre-splash-inner {
  padding: 24px;
}

#timbre-splash .timbre-splash-title {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-weight: 900;
  letter-spacing: 1px;
  line-height: 1.05;
  font-size: clamp(28px, 7vw, 72px);
  color: #000;
  text-shadow: 0 2px 0 rgba(255,255,255,.35);
}

#timbre-splash .timbre-splash-hint {
  margin-top: 18px;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-weight: 700;
  font-size: clamp(14px, 3.5vw, 20px);
  color: rgba(0,0,0,.85);
  opacity: 0.9;
}
