:root {
    --primary: #0052D4;
    --primary-hover: #0041a8;
    --accent: #1EAF5B;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --badge-bg: #F0F5FF;
    --radius-lg: 24px;
    --radius-md: 16px;
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Plus Jakarta Sans', sans-serif; -webkit-font-smoothing: antialiased; }
body {
    background-color: var(--bg);
    color: var(--text-main);
    line-height: 1.6;
    background-image: radial-gradient(at 0% 0%, rgba(0, 82, 212, 0.05) 0px, transparent 50%);
}

/* Header */
header {
    padding: 0.75rem 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border);
}
.navbar { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.logo { text-decoration: none; display: flex; align-items: center; }
.main-logo { height: 40px; width: auto; display: block; }
.mobile-logo { display: none; }

@media (max-width: 600px) {
    .main-logo { display: none; }
    .mobile-logo { display: block; height: 32px; width: auto; }
}

/* Container & Typography */
.container { max-width: 1200px; margin: 3rem auto; padding: 0 1.5rem; }
.header-section { text-align: center; margin-bottom: 3rem; }
h1 { font-size: 2.5rem; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 0.5rem; }
.subtitle { color: var(--text-muted); font-size: 1.1rem; }

/* Drop Zone */
.drop-zone {
    background: var(--card-bg);
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 4rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}
.drop-zone:hover { border-color: var(--primary); background: #fdf2f1; transform: translateY(-2px); box-shadow: var(--shadow-md); }
.drop-icon { font-size: 3rem; margin-bottom: 1rem; }
.drop-text { font-size: 1.25rem; font-weight: 700; color: var(--text-main); margin-bottom: 0.5rem; }
.drop-info { font-size: 0.875rem; color: var(--text-muted); font-weight: 500; }
#file-input { display: none; }

/* Editor Layout */
.editor-layout { display: flex; gap: 2rem; align-items: flex-start; }

.preview-side {
    flex: 1;
    background: #f1f5f9;
    padding: 40px;
    border-radius: var(--radius-lg);
    min-height: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    border: 1px solid var(--border);
}
.preview-hint { display: flex; align-items: center; gap: 8px; font-size: 0.875rem; color: var(--text-muted); font-weight: 600; background: white; padding: 8px 16px; border-radius: 100px; box-shadow: var(--shadow-sm); }

.pages-list { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 30px; }
.page-preview-container { position: relative; background: white; box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1); border-radius: 4px; overflow: hidden; }
.page-label { position: absolute; top: -25px; left: 0; font-size: 0.75rem; font-weight: 800; color: var(--text-muted); text-transform: uppercase; }

/* Watermark Overlay Styles */
.watermark-overlay {
    position: absolute;
    border: 2px solid var(--primary);
    background: rgba(99, 102, 241, 0.05);
    cursor: move;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}
.watermark-overlay::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(45deg, transparent, transparent 5px, rgba(99, 102, 241, 0.05) 5px, rgba(99, 102, 241, 0.05) 10px); pointer-events: none; }

.resizer { width: 12px; height: 12px; background: white; border: 2px solid var(--primary); position: absolute; border-radius: 50%; box-shadow: var(--shadow-sm); z-index: 10; }
.resizer.nw { top: -6px; left: -6px; cursor: nw-resize; }
.resizer.ne { top: -6px; right: -6px; cursor: ne-resize; }
.resizer.sw { bottom: -6px; left: -6px; cursor: sw-resize; }
.resizer.se { bottom: -6px; right: -6px; cursor: se-resize; }

/* Controls Panel */
.controls-side {
    flex: 0 0 380px;
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 100px;
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.group-title { font-size: 0.875rem; font-weight: 800; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 1rem; display: block; }

.label-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.label-row label { font-weight: 700; font-size: 0.95rem; }

.btn-clear { background: #fef2f2; color: #ef4444; border: none; font-size: 0.75rem; font-weight: 700; padding: 4px 10px; border-radius: 6px; cursor: pointer; transition: all 0.2s; }
.btn-clear:hover { background: #fee2e2; }

.value-badge {
    background: var(--primary);
    color: white;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 6px;
}

/* File Upload Wrapper Customizado */
.file-upload-wrapper {
    display: block;
    width: 100%;
    cursor: pointer;
}

.upload-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 1rem;
    background: #f8fafc;
    border: 2px dashed var(--border);
    border-radius: 12px;
    color: var(--text-main);
    font-weight: 700;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.file-upload-wrapper:hover .upload-content {
    border-color: var(--primary);
    background: #f5f3ff;
    color: var(--primary);
}

#wm-image-input {
    display: none;
}

/* Inputs Modernos */
input[type="text"].modern-input,
#wm-text-input {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s;
    background: #f8fafc;
}
input[type="text"]:focus { outline: none; border-color: var(--primary); background: white; box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1); }

.control-grid { display: grid; grid-template-columns: 80px 1fr; gap: 1rem; margin-top: 1rem; }

/* Color Picker */
.color-picker-wrapper { width: 100%; height: 42px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
input[type="color"] { border: none; width: 140%; height: 140%; margin: -20%; cursor: pointer; }

/* Range Slider */
.modern-range { -webkit-appearance: none; width: 100%; height: 6px; background: #e2e8f0; border-radius: 5px; outline: none; margin: 15px 0; }
.modern-range::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; background: var(--primary); border-radius: 50%; cursor: pointer; border: 3px solid white; box-shadow: var(--shadow-sm); }

/* Tabs */
.tab-buttons { display: flex; background: #f1f5f9; padding: 4px; border-radius: 12px; }
.tab-btn { flex: 1; border: none; padding: 0.75rem; border-radius: 10px; background: none; cursor: pointer; font-weight: 700; color: var(--text-muted); transition: all 0.2s; }
.tab-btn.active { background: white; color: var(--primary); box-shadow: var(--shadow-sm); }

/* Alignment */
.alignment-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.align-btn {
    height: 48px;
    border: 1px solid var(--border);
    background: white;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.25rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.align-btn:hover { border-color: var(--primary); background: #f5f3ff; }
.align-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.align-btn[data-align="center"] { grid-column: 2; grid-row: 2; }
.align-btn[data-align="tl"] { grid-column: 1; grid-row: 1; }
.align-btn[data-align="tr"] { grid-column: 3; grid-row: 1; }
.align-btn[data-align="bl"] { grid-column: 1; grid-row: 3; }
.align-btn[data-align="br"] { grid-column: 3; grid-row: 3; }

/* Checkbox Personalizado */
.custom-checkbox { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 0.95rem; font-weight: 600; position: relative; }
.custom-checkbox input { position: absolute; opacity: 0; cursor: pointer; height: 0; width: 0; }
.checkmark { height: 20px; width: 20px; background-color: #e2e8f0; border-radius: 6px; transition: all 0.2s; }
.custom-checkbox:hover input ~ .checkmark { background-color: #cbd5e1; }
.custom-checkbox input:checked ~ .checkmark { background-color: var(--primary); }
.checkmark:after { content: ""; position: absolute; display: none; left: 7px; top: 3px; width: 5px; height: 10px; border: solid white; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.custom-checkbox input:checked ~ .checkmark:after { display: block; }

.apply-all-box { background: #f5f3ff; padding: 1rem; border-radius: 12px; border: 1px solid #ddd6fe; }
.highlight { color: var(--primary); }

/* Botão de Ação */
.btn-action {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    border: none;
    padding: 1.25rem;
    border-radius: 16px;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
.btn-action:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4); }
.btn-action:active { transform: translateY(0); }

#status { margin-top: 0.5rem; font-size: 0.875rem; font-weight: 700; color: var(--primary); text-align: center; }

.btn-text-action {
    background: none;
    border: none;
    color: var(--primary);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}
.btn-text-action:hover { background: var(--badge-bg); }

.btn-clear-data {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff1f2;
    color: #e11d48;
    border: 1px solid #fecdd3;
    padding: 8px 16px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-clear-data:hover {
    background: #ffe4e6;
    border-color: #fda4af;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(225, 29, 72, 0.15);
}


/* Mobile Responsiveness */
@media (max-width: 1024px) {
    .editor-layout { flex-direction: column; }
    .controls-side { flex: 1; width: 100%; position: static; }
    .preview-side { padding: 20px; min-height: auto; }
}

@media (max-width: 640px) {
    h1 { font-size: 1.75rem; }
    .container { margin: 1.5rem auto; }
    .drop-zone { padding: 2rem 1rem; }
}
