@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap");

:root {
    --bg: #080811;
    --bg-secondary: #0f0f1c;
    --card: rgba(20, 20, 36, 0.72);
    --card-hover: rgba(28, 28, 48, 0.82);
    --border: rgba(255, 255, 255, 0.09);
    --border-hover: rgba(255, 255, 255, 0.18);
    --text: #ffffff;
    --text-secondary: #a7a7bb;
    --text-muted: #707087;
    --purple: #8b5cf6;
    --purple-light: #a78bfa;
    --pink: #ec4899;
    --red: #ef4444;
    --green: #22c55e;
    --blue: #3b82f6;
    --shadow: 0 25px 70px rgba(0, 0, 0, 0.45);
    --radius: 20px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    font-family: "Poppins", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 15% 10%, rgba(139, 92, 246, 0.18), transparent 30%),
        radial-gradient(circle at 85% 80%, rgba(236, 72, 153, 0.12), transparent 30%),
        linear-gradient(135deg, #080811, #10101d 55%, #080811);
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        linear-gradient(
            rgba(5, 5, 12, 0.78),
            rgba(5, 5, 12, 0.9)
        ),
        url("https://i.imgur.com/z4guq1U.jpeg") center / cover no-repeat;
    opacity: 0.45;
    pointer-events: none;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(
            circle at center,
            transparent 0%,
            rgba(0, 0, 0, 0.25) 60%,
            rgba(0, 0, 0, 0.55) 100%
        );
    pointer-events: none;
}

/* =========================================================
   HEADER
========================================================= */

.header {
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    border-bottom: 1px solid var(--border);
    background: rgba(8, 8, 17, 0.72);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.header-container {
    width: min(1100px, calc(100% - 32px));
    min-height: 72px;
    margin: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    text-decoration: none;
}

.brand img {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    object-fit: cover;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.08),
        0 8px 25px rgba(0, 0, 0, 0.35);
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.brand-text strong {
    font-size: 0.95rem;
    font-weight: 700;
}

.brand-text span {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 500;
}

.about-header-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.045);
    color: var(--text);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.25s ease;
}

.about-header-btn i {
    color: var(--purple-light);
    font-size: 1rem;
}

.about-header-btn:hover {
    border-color: rgba(139, 92, 246, 0.45);
    background: rgba(139, 92, 246, 0.12);
    transform: translateY(-2px);
}

/* =========================================================
   CONTENEDOR
========================================================= */

.page-container {
    width: min(920px, calc(100% - 32px));
    margin: 0 auto;
    padding: 70px 0 45px;
}

/* =========================================================
   HERO
========================================================= */

.hero {
    margin-bottom: 38px;
    text-align: center;
}

.hero-icon {
    width: 68px;
    height: 68px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 20px;
    background:
        linear-gradient(
            145deg,
            rgba(139, 92, 246, 0.22),
            rgba(236, 72, 153, 0.08)
        );
    box-shadow:
        0 15px 45px rgba(139, 92, 246, 0.12),
        inset 0 1px rgba(255, 255, 255, 0.08);
}

.hero-icon i {
    font-size: 1.8rem;
    color: var(--purple-light);
}

.hero h1 {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: -0.8px;
}

.hero p {
    max-width: 650px;
    margin: 14px auto 0;
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.8;
}

/* =========================================================
   CARD PRINCIPAL
========================================================= */

.converter-card {
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
}

/* =========================================================
   UPLOAD
========================================================= */

.upload-box {
    position: relative;
    min-height: 235px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    border: 1px dashed rgba(167, 139, 250, 0.35);
    border-radius: 18px;
    background:
        radial-gradient(
            circle at center,
            rgba(139, 92, 246, 0.09),
            transparent 60%
        ),
        rgba(255, 255, 255, 0.025);
    cursor: pointer;
    overflow: hidden;
    transition: 0.3s ease;
}

.upload-box::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        120deg,
        transparent,
        rgba(255, 255, 255, 0.04),
        transparent
    );
    transform: translateX(-100%);
    transition: 0.6s ease;
}

.upload-box:hover {
    border-color: rgba(167, 139, 250, 0.65);
    background:
        radial-gradient(
            circle at center,
            rgba(139, 92, 246, 0.14),
            transparent 65%
        ),
        rgba(255, 255, 255, 0.035);
    transform: translateY(-2px);
}

.upload-box:hover::before {
    transform: translateX(100%);
}

.upload-box.dragging {
    border-color: var(--purple-light);
    background:
        radial-gradient(
            circle at center,
            rgba(139, 92, 246, 0.2),
            transparent 65%
        ),
        rgba(139, 92, 246, 0.06);
    transform: scale(1.01);
}

.upload-content {
    position: relative;
    z-index: 1;
    text-align: center;
}

.upload-icon {
    width: 62px;
    height: 62px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    background: rgba(139, 92, 246, 0.13);
    color: var(--purple-light);
}

.upload-icon i {
    font-size: 1.65rem;
}

.upload-content h2 {
    font-size: 1.05rem;
    font-weight: 600;
}

.upload-content p {
    margin-top: 7px;
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.upload-content span {
    display: block;
    margin-top: 12px;
    color: var(--text-muted);
    font-size: 0.7rem;
}

/* =========================================================
   PREVIEW HEADER
========================================================= */

.preview-header {
    margin-top: 28px;
    padding-bottom: 17px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    border-bottom: 1px solid var(--border);
}

.preview-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    background: rgba(139, 92, 246, 0.11);
    color: var(--purple-light);
}

.preview-title h2 {
    font-size: 0.92rem;
    font-weight: 600;
}

.preview-title span {
    display: block;
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 0.7rem;
}

.sort-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 13px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.045);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.74rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.25s ease;
}

.sort-btn:hover {
    color: var(--text);
    border-color: rgba(139, 92, 246, 0.4);
    background: rgba(139, 92, 246, 0.1);
}

/* =========================================================
   PREVIEW CONTAINER
========================================================= */

.preview-container {
    min-height: 170px;
    margin-top: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
    gap: 16px;
}

.empty-state {
    grid-column: 1 / -1;
    min-height: 190px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 25px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.018);
    text-align: center;
}

.empty-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.045);
    color: var(--text-muted);
}

.empty-state h3 {
    font-size: 0.82rem;
    font-weight: 600;
}

.empty-state p {
    margin-top: 5px;
    color: var(--text-muted);
    font-size: 0.7rem;
}

/* =========================================================
   TARJETAS DE IMAGEN
========================================================= */

.preview-box {
    position: relative;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.035);
    overflow: hidden;
    transition: 0.25s ease;
    animation: cardAppear 0.3s ease both;
}

.preview-box:hover {
    border-color: var(--border-hover);
    background: var(--card-hover);
    transform: translateY(-4px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25);
}

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.top-bar {
    position: absolute;
    top: 17px;
    left: 17px;
    right: 17px;
    z-index: 3;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
}

.icon-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 9px;
    background: rgba(5, 5, 12, 0.7);
    color: white;
    backdrop-filter: blur(10px);
    cursor: pointer;
    pointer-events: auto;
    transition: 0.2s ease;
}

.icon-btn:hover {
    background: rgba(139, 92, 246, 0.8);
    border-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.06);
}

.icon-btn.delete:hover {
    background: rgba(239, 68, 68, 0.85);
}

.preview-img {
    width: 100%;
    height: 190px;
    display: block;
    border-radius: 11px;
    object-fit: contain;
    background:
        linear-gradient(
            45deg,
            rgba(255, 255, 255, 0.025) 25%,
            transparent 25%
        ),
        linear-gradient(
            -45deg,
            rgba(255, 255, 255, 0.025) 25%,
            transparent 25%
        ),
        rgba(0, 0, 0, 0.22);
    background-size: 18px 18px;
    background-position:
        0 0,
        9px 9px;
}

.file-name {
    margin: 10px 4px 9px;
    color: var(--text-secondary);
    font-size: 0.68rem;
    font-weight: 500;
    line-height: 1.45;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.order-number {
    position: absolute;
    top: 18px;
    left: 18px;
    min-width: 26px;
    height: 26px;
    padding: 0 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(5, 5, 12, 0.75);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    backdrop-filter: blur(8px);
    pointer-events: none;
}

.controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
}

.controls button {
    height: 31px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.035);
    color: var(--text-secondary);
    cursor: pointer;
    transition: 0.2s ease;
}

.controls button:hover:not(:disabled) {
    border-color: rgba(139, 92, 246, 0.4);
    background: rgba(139, 92, 246, 0.11);
    color: white;
}

.controls button:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

/* =========================================================
   FORMULARIO
========================================================= */

.form-group {
    margin-top: 28px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 9px;
    color: var(--text-secondary);
    font-size: 0.76rem;
    font-weight: 600;
}

.form-group label i {
    color: var(--purple-light);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper > i {
    position: absolute;
    left: 15px;
    color: var(--text-muted);
    font-size: 0.85rem;
    pointer-events: none;
}

.input-wrapper input {
    width: 100%;
    height: 48px;
    padding: 0 65px 0 42px;
    border: 1px solid var(--border);
    border-radius: 13px;
    outline: none;
    background: rgba(255, 255, 255, 0.035);
    color: white;
    font-family: inherit;
    font-size: 0.8rem;
    transition: 0.25s ease;
}

.input-wrapper input::placeholder {
    color: var(--text-muted);
}

.input-wrapper input:focus {
    border-color: rgba(139, 92, 246, 0.6);
    background: rgba(139, 92, 246, 0.045);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.08);
}

.input-wrapper span {
    position: absolute;
    right: 15px;
    color: var(--text-muted);
    font-size: 0.75rem;
    pointer-events: none;
}

/* =========================================================
   ESTADO
========================================================= */

.status-message {
    min-height: 22px;
    margin-top: 12px;
    color: var(--text-muted);
    font-size: 0.72rem;
    text-align: center;
}

.status-message.loading {
    color: var(--purple-light);
}

.status-message.success {
    color: var(--green);
}

.status-message.error {
    color: #f87171;
}

/* =========================================================
   BOTONES
========================================================= */

.actions {
    margin-top: 6px;
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 12px;
}

.actions button {
    min-height: 50px;
    border-radius: 13px;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.25s ease;
}

.clear-btn {
    border: 1px solid rgba(239, 68, 68, 0.2);
    background: rgba(239, 68, 68, 0.07);
    color: #fca5a5;
}

.clear-btn:hover {
    border-color: rgba(239, 68, 68, 0.45);
    background: rgba(239, 68, 68, 0.13);
    color: white;
    transform: translateY(-2px);
}

.generate-btn {
    border: 1px solid rgba(139, 92, 246, 0.5);
    background: linear-gradient(
        135deg,
        rgba(139, 92, 246, 0.95),
        rgba(124, 58, 237, 0.95)
    );
    color: white;
    box-shadow: 0 12px 30px rgba(139, 92, 246, 0.18);
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 35px rgba(139, 92, 246, 0.3);
}

.generate-btn:disabled {
    opacity: 0.55;
    cursor: wait;
    transform: none;
}

/* =========================================================
   MODAL IMAGEN
========================================================= */

.modal {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 30px;
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

.modal.active {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.modal img {
    max-width: min(100%, 1000px);
    max-height: 88vh;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 15px;
    object-fit: contain;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}

.modal-close {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 42px;
    height: 42px;
    z-index: 2;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(20, 20, 30, 0.8);
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: 0.2s ease;
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.75);
    transform: rotate(5deg);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* =========================================================
   ABOUT PANEL
========================================================= */

.about-panel {
    position: fixed;
    inset: 0;
    z-index: 200;
    visibility: hidden;
    pointer-events: none;
}

.about-panel.active {
    visibility: visible;
    pointer-events: auto;
}

.about-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(5px);
    opacity: 0;
    transition: 0.3s ease;
}

.about-panel.active .about-overlay {
    opacity: 1;
}

.about-content {
    position: absolute;
    top: 0;
    right: 0;
    width: min(430px, 92%);
    height: 100%;
    padding: 32px 28px;
    overflow-y: auto;
    border-left: 1px solid var(--border);
    background:
        linear-gradient(
            180deg,
            rgba(18, 18, 32, 0.96),
            rgba(9, 9, 17, 0.98)
        );
    box-shadow: -20px 0 70px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(25px);
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.about-panel.active .about-content {
    transform: translateX(0);
}

.about-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.045);
    color: var(--text-secondary);
    cursor: pointer;
    transition: 0.2s ease;
}

.about-close:hover {
    background: rgba(239, 68, 68, 0.14);
    color: white;
}

.about-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-right: 45px;
    margin-bottom: 28px;
}

.about-header img {
    width: 55px;
    height: 55px;
    border-radius: 15px;
}

.about-header h2 {
    font-size: 1.15rem;
}

.about-header p {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 0.7rem;
}

.about-section {
    padding: 20px 0;
    border-top: 1px solid var(--border);
}

.about-section h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
}

.about-section h3 i {
    color: var(--purple-light);
}

.links {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.links a {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.035);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    transition: 0.25s ease;
}

.links a:hover {
    border-color: rgba(139, 92, 246, 0.45);
    background: rgba(139, 92, 246, 0.12);
    color: white;
    transform: translateY(-3px);
}

/* =========================================================
   TOAST
========================================================= */

.toast {
    position: fixed;
    left: 50%;
    bottom: 25px;
    z-index: 500;
    min-width: 240px;
    max-width: calc(100% - 30px);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: rgba(18, 18, 30, 0.9);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(18px);
    color: var(--text);
    font-size: 0.74rem;
    transform: translate(-50%, 120px);
    opacity: 0;
    pointer-events: none;
    transition: 0.3s ease;
}

.toast.show {
    transform: translate(-50%, 0);
    opacity: 1;
}

.toast i {
    color: var(--green);
}

/* =========================================================
   FOOTER
========================================================= */

.footer {
    padding: 0 20px 30px;
    text-align: center;
}

.footer p {
    color: var(--text-muted);
    font-size: 0.68rem;
}

.footer a {
    color: var(--purple-light);
    text-decoration: none;
}

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

/* =========================================================
   SCROLLBAR
========================================================= */

::-webkit-scrollbar {
    width: 7px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.12);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 700px) {

    body::before {
        background:
            radial-gradient(
                circle at 20% 10%,
                rgba(139, 92, 246, 0.16),
                transparent 35%
            ),
            radial-gradient(
                circle at 85% 80%,
                rgba(236, 72, 153, 0.1),
                transparent 35%
            );
        opacity: 1;
    }

    body::after {
        background: none;
    }

    .header-container {
        min-height: 64px;
        width: min(100% - 22px, 920px);
    }

    .brand img {
        width: 38px;
        height: 38px;
    }

    .brand-text strong {
        font-size: 0.82rem;
    }

    .brand-text span {
        font-size: 0.6rem;
    }

    .about-header-btn {
        min-height: 38px;
        padding: 0 12px;
        font-size: 0.72rem;
    }

    .page-container {
        width: min(100% - 22px, 920px);
        padding-top: 45px;
    }

    .hero {
        margin-bottom: 28px;
    }

    .hero-icon {
        width: 58px;
        height: 58px;
        border-radius: 17px;
    }

    .hero h1 {
        font-size: 1.65rem;
    }

    .hero p {
        font-size: 0.78rem;
        line-height: 1.7;
    }

    .converter-card {
        padding: 17px;
        border-radius: 17px;
    }

    .upload-box {
        min-height: 205px;
        padding: 20px;
    }

    .preview-container {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .preview-img {
        height: 150px;
    }

    .preview-header {
        align-items: flex-start;
    }

    .sort-btn span {
        display: none;
    }

    .sort-btn {
        width: 39px;
        height: 39px;
        padding: 0;
    }

    .actions {
        grid-template-columns: 1fr;
    }

    .generate-btn {
        order: -1;
    }

    .about-content {
        width: 100%;
        padding: 28px 20px;
    }
}

@media (max-width: 420px) {

    .brand-text {
        display: none;
    }

    .about-header-btn span {
        display: none;
    }

    .about-header-btn {
        width: 40px;
        padding: 0;
    }

    .hero h1 {
        font-size: 1.45rem;
    }

    .hero p {
        font-size: 0.74rem;
    }

    .preview-img {
        height: 135px;
    }

    .file-name {
        font-size: 0.62rem;
    }

    .upload-content h2 {
        font-size: 0.95rem;
    }

    .upload-content p {
        font-size: 0.74rem;
    }
}