/* ============================================
   PIXELFLOW - ESTILOS REDISEÑADOS
   ============================================ */

:root {
    --bg: #f8fafc;
    --surface: #ffffff;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --accent: #f59e0b;
    --text: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.1), 0 4px 8px rgba(0,0,0,0.06);
    --radius-sm: 10px;
    --radius: 14px;
    --radius-lg: 18px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

body {
    margin: 0;
    font-family: var(--font);
    background: linear-gradient(160deg, #f1f5f9 0%, #e8edf3 30%, #f8fafc 60%, #eef2f6 100%);
    background-attachment: fixed;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

/* ===== TEXTURA DE FONDO SUTIL ===== */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(79, 70, 229, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(245, 158, 11, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(148, 163, 184, 0.02) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* ===== MENÚ HAMBURGUESA ===== */
#menuBtn {
    position: fixed;
    top: 18px;
    left: 18px;
    font-size: 22px;
    z-index: 100;
    cursor: pointer;
    width: 44px;
    height: 44px;
    background: var(--surface);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    border: 1px solid var(--border);
}

#menuBtn:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

#menu {
    position: fixed;
    top: 70px;
    left: 18px;
    background: var(--surface);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    padding: 8px;
    display: none;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    z-index: 99;
    min-width: 180px;
}

#menu div {
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
    transition: var(--transition);
}

#menu div:hover {
    background: #f1f5f9;
    color: var(--primary);
}

/* ===== CONTENIDO CENTRAL ===== */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding-top: 60px;
    padding-bottom: 140px;
    position: relative;
    z-index: 1;
}

/* ===== BOTÓN CARGAR IMAGEN ===== */
#loadBtn {
    padding: 16px 32px;
    border: none;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: var(--transition);
    letter-spacing: 0.3px;
}

#loadBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.3);
}

#loadBtn:active {
    transform: scale(0.97);
}

/* ===== CONTENEDOR DEL PREVIEW ===== */
.previewBox {
    margin-top: 24px;
    width: 90%;
    max-width: 800px;
    height: calc(100vh - 200px);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

#preview {
    max-width: 90%;
    max-height: 85%;
    display: none;
    transition: transform 0.3s ease;
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-sm);
    object-fit: contain;
}

/* ===== BOTONES INFERIORES ===== */
.bottomBar {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    background: var(--surface);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    z-index: 50;
    max-width: 95vw;
    margin-bottom: 50px; /* Espacio para el footer */
}

.bottomBar button {
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: white;
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
}

.bottomBar button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.25);
}

.bottomBar button:active {
    transform: scale(0.95);
}

/* ===== BOTONES FLOTANTES DERECHA ===== */
.floatBtns {
    position: fixed;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 14px;
    z-index: 40;
}

.floatBtns button,
#cropManualBtn {
    width: 48px;
    height: 48px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.floatBtns button:hover,
#cropManualBtn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

#undoFloat {
    background: #fef2f2;
    border-color: #fecaca;
}

#undoFloat:hover {
    background: #fee2e2;
}

#cropFloat,
#cropManualBtn {
    border: 2px dashed #c7d2fe;
}

#cropFloat:hover,
#cropManualBtn:hover {
    border-color: var(--primary);
    background: #eef2ff;
}

#rotateBtn {
    background: #f0fdf4;
    border-color: #bbf7d0;
    margin-top: 4px;
    border-radius: 50% !important;
}

#rotateBtn:hover {
    background: #dcfce7;
}

/* ===== DROPDOWN PRESETS ===== */
.floatDropdown {
    display: none;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.floatDropdown button {
    width: 48px;
    height: 36px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 700;
    font-family: var(--font);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.floatDropdown button:hover {
    background: #eef2ff;
    border-color: var(--primary);
}

/* ===== BOTÓN APLICAR CROP ===== */
#applyCropBtn {
    position: fixed;
    left: 18px;
    top: 50%;
    transform: translateY(60px);
    width: 48px;
    height: 48px;
    background: #fefce8;
    border: 2px solid #fde047;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    z-index: 40;
}

#applyCropBtn:hover {
    background: #fef08a;
    transform: translateY(57px);
    box-shadow: var(--shadow-lg);
}

/* ===== DROPDOWN MÁS FORMATOS ===== */
#moreFormatsDropdown {
    display: none;
    position: absolute;
    bottom: 50px;
    left: 0;
    background: var(--surface);
    padding: 6px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 60;
    flex-direction: column;
    gap: 4px;
    min-width: 100px;
}

#moreFormatsDropdown button {
    width: 100%;
    margin: 0;
}

/* ===== SLIDER ROTAR ===== */
#rotateSlider {
    margin-top: 6px;
    accent-color: var(--primary);
}

/* ===== LOGO PIXELFLOW ===== */
.app-logo {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 50;
}

.app-logo img {
    height: 32px;
    opacity: 0.7;
    transition: var(--transition);
}

.app-logo img:hover {
    opacity: 1;
}

/* ===== FOOTER MARCA ===== */
.brand-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    z-index: 60; /* Por encima de la barra de botones */
    pointer-events: none;
    background: linear-gradient(to top, rgba(248, 250, 252, 0.95) 60%, transparent);
    padding: 8px 0 4px;
}

.brand-footer p {
    font-family: var(--font);
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin: 0;
    pointer-events: auto;
}

.brand-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.brand-footer a:hover {
    color: var(--primary-hover);
}

.brand-footer img {
    height: 14px;
    vertical-align: middle;
    opacity: 0.5;
    margin-right: 4px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .floatBtns {
        right: 8px;
        gap: 10px;
    }

    .floatBtns button,
    #cropManualBtn,
    #applyCropBtn {
        width: 40px;
        height: 40px;
        font-size: 17px;
    }

    .bottomBar {
        padding: 10px 14px;
        gap: 6px;
    }

    .bottomBar button {
        padding: 8px 12px;
        font-size: 0.75rem;
    }

    #loadBtn {
        padding: 14px 24px;
        font-size: 0.9rem;
    }

    .previewBox {
        width: 95%;
        height: calc(100vh - 230px);
    }
}

@media (max-width: 480px) {
    .floatBtns {
        right: 4px;
        gap: 8px;
    }

    .floatBtns button,
    #cropManualBtn,
    #applyCropBtn {
        width: 36px;
        height: 36px;
        font-size: 15px;
        border-radius: 10px;
    }

    .bottomBar {
        padding: 8px 10px;
        gap: 4px;
        border-radius: 14px;
    }

    .bottomBar button {
        padding: 7px 10px;
        font-size: 0.7rem;
    }

    .bottomBar {
    margin-bottom: 45px;
    }
}