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

:root {
    --bg: #0d0d0d;
    --surface: #1a1a2e;
    --primary: #1976d2;
    --primary-hover: #2196f3;
    --accent: #ff1744;
    --text: #e0e0e0;
    --text-secondary: #b0bec5;
    --border: rgba(255,255,255,0.08);
    --shadow: 0 4px 24px rgba(0,0,0,0.5);
    --radius: 12px;
    --font: system-ui, -apple-system, sans-serif;
}

* {
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font);
    background: var(--bg);
    overflow: hidden;
    touch-action: none;
    color: var(--text);
}

/* ===== LOGO ===== */
.app-logo {
    position: fixed;
    top: 12px;
    right: 16px;
    z-index: 100001;
}

.app-logo img {
    height: 28px;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

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

/* ===== EDITOR ===== */
#editor {
    touch-action: none;
    flex: 1;
    position: relative;
    background: linear-gradient(180deg, #1a1a2e 0%, #0f0f1a 100%);
    overflow: auto;
    height: 100vh;
    padding-top: 60px;
    padding-bottom: 80px;
}

/* ===== PANTALLA DE CARGA ===== */
#uploadScreen {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: linear-gradient(160deg, #0f0f1a 0%, #1a1a2e 50%, #0d0d0d 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    gap: 16px;
}

.upload-icon {
    font-size: 64px;
    filter: drop-shadow(0 0 20px rgba(25, 118, 210, 0.5));
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

#uploadScreen h2 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff, #1976d2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.upload-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.upload-btn {
    display: inline-block;
    padding: 14px 32px;
    border-radius: 50px;
    background: linear-gradient(135deg, #1976d2, #1565c0);
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(25, 118, 210, 0.3);
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(25, 118, 210, 0.4);
}

#uploadScreen input[type="file"] {
    display: none;
}

/* ===== CANVAS ===== */
#pdfCanvas {
    display: none;
    position: relative;
    z-index: 1;
    width: 100%;
    height: auto;
    box-shadow: 0 4px 32px rgba(0, 0, 0, 0.7);
    border-radius: 4px;
}

/* ===== OVERLAY ===== */
#overlay {
    position: absolute;
    top: 60px; left: 0;
    width: 100%;
    height: calc(100% - 60px);
    overflow: visible;
    pointer-events: none;
    z-index: 2000;
}

#overlay canvas#signCanvas,
#overlay .draggable,
#overlay button {
    pointer-events: auto;
}

#overlay canvas#signCanvas {
    touch-action: none;
    cursor: crosshair;
    background: rgba(255,255,255,0.04);
    border: 2px dashed rgba(255,255,255,0.25);
    border-radius: 8px;
}

/* ===== ELEMENTOS ARRASTRABLES ===== */
.draggable {
    position: absolute;
    touch-action: none;
    min-width: 40px;
    min-height: 40px;
    transition: opacity 0.15s ease;
}

.draggable::after {
    content: "";
    position: absolute;
    top: -25px; left: -25px;
    right: -25px; bottom: -25px;
    z-index: -1;
}

.draggable.selected {
    outline: 2px dashed var(--accent);
    outline-offset: 4px;
    filter: drop-shadow(0 0 8px rgba(255,23,68,0.5));
}

.text-box {
    min-width: 80px;
    min-height: 30px;
    font-size: 16px;
    cursor: move;
    white-space: nowrap;
    padding: 4px 8px;
    background: transparent;
    border: none;
    color: #000;
    overflow: visible;
    display: inline-block;
}

/* ===== BARRA DE CONTROLES ===== */
#controls {
    position: fixed;
    bottom: 40px;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 10px;
    z-index: 3000;
    padding: 12px 10px 8px;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 100%);
}

#controls button {
    background: rgba(15, 15, 30, 0.85);
    color: #c8d8f0;
    border-radius: 24px;
    padding: 9px 16px;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.1);
    backdrop-filter: blur(6px);
    transition: all 0.2s ease;
    white-space: nowrap;
    cursor: pointer;
}

#controls button:active {
    background: rgba(25, 118, 210, 0.75);
    color: #fff;
    transform: scale(0.95);
}

/* ===== MENÚ HAMBURGUESA ===== */
#menuBtn {
    position: fixed;
    top: 12px; left: 12px;
    z-index: 100000;
    font-size: 22px;
    background: rgba(255,255,255,0.07);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.1);
    cursor: pointer;
    padding: 7px 10px;
    color: #fff;
    border-radius: 10px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

#menuBtn:active {
    background: rgba(255,255,255,0.14);
    transform: scale(0.95);
}

#menuDropdown {
    position: fixed;
    top: 54px; left: 12px;
    background: rgba(18, 18, 30, 0.97);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.55);
    display: none;
    z-index: 100000;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.07);
    min-width: 190px;
}

#menuDropdown div {
    padding: 12px 18px;
    cursor: pointer;
    color: #d0d8e8;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.15s ease;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

#menuDropdown div:last-child {
    border-bottom: none;
}

#menuDropdown div:active {
    background: rgba(25, 118, 210, 0.22);
}

/* ===== UI LAYER ===== */
#uiLayer {
    position: fixed;
    inset: 0;
    z-index: 5000;
    pointer-events: none;
}

#uiLayer button {
    pointer-events: auto;
    background: rgba(20, 20, 40, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 14px;
    color: #e0e6f0;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    transition: all 0.2s ease;
    cursor: pointer;
}

#uiLayer button:active {
    transform: scale(0.92);
    background: rgba(25, 118, 210, 0.25);
}

/* ===== FOOTER MARCA ===== */
.brand-footer {
    position: fixed;
    bottom: 8px;
    left: 0;
    right: 0;
    text-align: center;
    z-index: 6000;
    pointer-events: none;
}

.brand-footer p {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.25);
    margin: 0;
    pointer-events: auto;
}

.brand-footer a {
    color: rgba(255,255,255,0.4);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

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

.footer-logo {
    height: 12px;
    vertical-align: middle;
    opacity: 0.4;
    margin-right: 4px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
    #controls button {
        padding: 7px 12px;
        font-size: 11px;
    }

    #controls {
        gap: 6px;
        bottom: 30px;
    }

    .upload-btn {
        padding: 12px 24px;
        font-size: 0.85rem;
    }
}