*, *::before, *::after {
  box-sizing: border-box;
}

/* Estilos generales */
:root {
    --bg-color: #f4f4f5;
    --text-color: #000;
    --app-bg: #fff;
    --drop-border: #001ede;
    --drop-text: #001ede;
    --drop-hover-bg: #d0f0ff;
    --button-bg: #23D5D5;
    --button-hover-bg: #39AAAA;
    --preview-bg: #000;
    --input-border-color: #ccc; 
    --image-border-color: #fff; 
    --gradient-from: #67e8f9; 
    --gradient-to: #0891b2; 
}

[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-color: #f4f4f5;
    --app-bg: #262626;
    --drop-border: #22d3ee;
    --drop-text: #67e8f9;
    --drop-hover-bg: #0e7490;
    --button-bg: #0ea5e9;
    --button-hover-bg: #0284c7;
    --preview-bg: #111;
    --input-border-color: #4b5563;
    --image-border-color: #e5e7eb;
    --gradient-from: #22d3ee;
    --gradient-to: #0ea5e9;
}

a {
    color: var(--text-color);
    text-decoration: none;
    font: 700 1rem sans-serif;
}

a:hover {
    color: var(--button-bg);
    text-decoration: underline;
}

body {
    font-family: sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    transition: background-color 0.3s, color 0.3s;
}

.main-title {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 1rem;
  background-image: linear-gradient(to bottom, var(--gradient-from), var(--gradient-to));
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
}

input::placeholder {
  opacity: 0.5;
  color: black;
}

#app {
    width: 100%;
    max-width: 800px;
    text-align: center;
    background: var(--app-bg);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: background-color 0.3s, color 0.3s;
}

/* Área de Drag & Drop */
#drop-zone {
    border: 2px dashed var(--drop-border);
    border-radius: 8px;
    padding: 40px;
    cursor: pointer;
    transition: background-color 0.3s, border-color 0.3s;
}
#drop-zone p {
    margin: 0;
    font-size: 1.2em;
    color: var(--drop-text);
}
#drop-zone.drag-over {
    background-color: var(--drop-hover-bg);
    border-color: #4500b3;
}

/* Controles */
#controls {
    margin: 2rem 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}
.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}
select, input[type="number"], button, input[type="text"] {
    padding: 10px;
    /* CAMBIO: Borde ahora usa una variable */
    border: 1px solid var(--input-border-color);
    border-radius: 10rem;
    font-size: 1em;
}
button {
    background-color: var(--button-bg);
    color: white;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s;
}
button:hover {
    background-color: var(--button-hover-bg);
}

/* Contenedor de la previsualización */
#preview-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 8px;
    margin: 0 auto;
    background-color: var(--preview-bg);
}

#background-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    filter: blur(25px);
    transform: scale(1.5); 
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    animation-direction: alternate;
}

#foreground-image {
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    width: 30%;
    height: auto;
    max-width: 25rem;
    min-width: 8rem;
    background-size: cover;
    background-position: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
    cursor: pointer;
}

.has-border {
    /* CAMBIO: Borde ahora usa una variable */
    border: 2px solid var(--image-border-color);
}

/* Foreground wrapper and text display */
#foreground-wrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

#custom-text-display {
    position: relative;
    margin-top: 0.5rem;
    transform: none;
    font-size: 1.2rem;
    border-radius: 10rem;
    text-align: center;
    color: #fff;
}

.hidden {
    display: none !important;
}

/* Shapes */
.shape-default {
    width: 100%;
    height: 100%;
    padding: 10rem 15rem;
    border-radius: 15px;
    clip-path: none;
}

.shape-square {
    width: 65%;
    height: auto;
    padding: 10rem;
    aspect-ratio: 1 / 1;
    border-radius: 15px;
    clip-path: none;
}

.shape-circle {
    width: 65%;
    height: auto;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    clip-path: none;
    padding: 10rem;
}

.shape-triangle {
    width: 70%;
    height: auto;
    aspect-ratio: 1 / 1;
    border-radius: 0;
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    padding: 10rem;
}

/* Fullscreen styling */
#preview-container:fullscreen {
    border-radius: 0;
}

/* Animations */
@keyframes move-left-to-right {
  from { transform: scale(1.5) translateX(-5%); }
  to   { transform: scale(1.5) translateX(5%); }
}
@keyframes move-right-to-left {
  from { transform: scale(1.5) translateX(5%); }
  to   { transform: scale(1.5) translateX(-5%); }
}
@keyframes move-top-to-bottom {
  from { transform: scale(1.5) translateY(-5%); }
  to   { transform: scale(1.5) translateY(5%); }
}
@keyframes move-bottom-to-top {
  from { transform: scale(1.5) translateY(5%); }
  to   { transform: scale(1.5) translateY(-5%); }
}
@keyframes move-zoom-in {
  from { transform: scale(1.5); }
  to   { transform: scale(1.6); }
}
@keyframes move-zoom-out {
  from { transform: scale(1.6); }
  to   { transform: scale(1.5); }
}

/* CAMBIO: Animación de spin corregida */
.spin-animation {
    animation: spin 10s linear infinite;
    transform-origin: center center;
}

@keyframes spin {
  from { transform: translateX(-50%) rotate(0deg); }
  to   { transform: translateX(-50%) rotate(360deg); }
}

/* Media queries */
@media (max-width: 600px) {
    #foreground-image {
        width: 70%;
        max-width: 18rem;
    }
}

/* Theme toggle button */
#theme-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.5rem 1rem;
    background-color: var(--button-bg);
    color: white;
    border: none;
    border-radius: 10rem;
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s;
}

/* 1. Por defecto, el bloqueo está oculto. */
#screen-blocker {
    display: none;
}

/* 2. Media Query para pantallas de menos de 768px de ancho. */
@media (max-width: 767px) {

    /* 3. Ocultamos la aplicación principal y el botón de tema. */
    #app, #theme-toggle {
        display: none !important;
    }

    /* 4. Mostramos el mensaje de bloqueo y lo centramos. */
    #screen-blocker {
        display: flex;
        justify-content: center;
        align-items: center;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: var(--bg-color);
        color: var(--text-color); 
        padding: 2rem;
        z-index: 9999;
    }

    .blocker-content {
        text-align: center;
    }

    .blocker-content h1 {
        font-size: 2.5rem;
        color: var(--drop-text); 
        margin-bottom: 1rem;
    }

    .blocker-content p {
        font-size: 1.2rem;
        margin-bottom: 0.5rem;
    }
    
    .blocker-content span {
        opacity: 0.8;
    }
}

