/* ===========================
   PDFTools — Estilos Globais
   =========================== */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #e63946;
    --primary-dark: #c1121f;
    --text: #1d1d1f;
    --text-muted: #6e6e73;
    --bg: #f5f5f7;
    --white: #ffffff;
    --border: #d2d2d7;
    --radius: 16px;
    --shadow: 0 4px 24px rgba(0,0,0,0.08);
    --shadow-hover: 0 8px 40px rgba(0,0,0,0.14);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ===== HEADER ===== */
.header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text);
    font-size: 1.25rem;
}

.logo-icon { font-size: 1.5rem; }
.logo-text strong { color: var(--primary); }

.nav {
    display: flex;
    gap: 24px;
}

.nav a {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
}

.nav a:hover { color: var(--primary); }

/* ===== HERO ===== */
.hero {
    background: linear-gradient(135deg, #fff 0%, #fef2f2 100%);
    padding: 72px 0 56px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 16px;
}

.highlight {
    color: var(--primary);
}

.hero-sub {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 520px;
    margin: 0 auto;
}

/* ===== TOOLS SECTION ===== */
.tools-section {
    padding: 64px 0;
}

.section-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 36px;
    text-align: center;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.tool-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    text-decoration: none;
    color: var(--text);
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    box-shadow: var(--shadow);
}

.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary);
}

.tool-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    flex-shrink: 0;
}

.tool-info h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.tool-info p {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.tool-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tool-badge.popular {
    background: #e8f4fd;
    color: #1a73e8;
}

.tool-badge.hot {
    background: #fde8e8;
    color: var(--primary);
}

/* ===== HOW IT WORKS ===== */
.how-section {
    background: var(--white);
    padding: 64px 0;
    border-top: 1px solid var(--border);
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 32px;
    text-align: center;
}

.step-num {
    width: 48px;
    height: 48px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 800;
    margin: 0 auto 16px;
}

.step h4 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.step p {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* ===== FOOTER ===== */
.footer {
    background: var(--text);
    color: #a1a1a6;
    text-align: center;
    padding: 32px 0;
    font-size: 0.875rem;
}

.footer-sub {
    margin-top: 6px;
    font-size: 0.8rem;
    opacity: 0.7;
}

/* ===== TOOL PAGE (layout interno) ===== */
.tool-page {
    min-height: calc(100vh - 64px);
    padding: 48px 0;
}

.tool-page-header {
    text-align: center;
    margin-bottom: 40px;
}

.tool-page-header .tool-page-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.tool-page-header h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.tool-page-header p {
    color: var(--text-muted);
    font-size: 1rem;
}

/* ===== UPLOAD BOX ===== */
.upload-box {
    background: var(--white);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 48px 32px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    max-width: 640px;
    margin: 0 auto;
}

.upload-box:hover,
.upload-box.dragover {
    border-color: var(--primary);
    background: #fff5f5;
}

.upload-box .upload-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.upload-box h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.upload-box p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 20px;
}

.upload-box input[type="file"] {
    display: none;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-success {
    background: #2d9e5f;
    color: white;
}

.btn-success:hover {
    background: #237a4a;
}

.btn-lg {
    padding: 16px 40px;
    font-size: 1.05rem;
}

/* ===== FORM ELEMENTS ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--white);
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

/* ===== FILE LIST ===== */
.file-list {
    max-width: 640px;
    margin: 20px auto 0;
}

.file-item {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.file-item .file-name {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-item .file-size {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.file-item .remove-file {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.1rem;
    padding: 2px 6px;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
}

.file-item .remove-file:hover {
    background: #fde8e8;
    color: var(--primary);
}

/* ===== RESULT BOX ===== */
.result-box {
    background: var(--white);
    border: 1px solid #b7e4c7;
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    max-width: 640px;
    margin: 32px auto 0;
}

.result-box .result-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.result-box h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: #2d9e5f;
}

.result-box p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

/* ===== ALERT ===== */
.alert {
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 0.9rem;
    margin-bottom: 20px;
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
}

.alert-error {
    background: #fde8e8;
    color: #c1121f;
    border: 1px solid #f5c6c6;
}

.alert-success {
    background: #e8fdf0;
    color: #1a7a45;
    border: 1px solid #b7e4c7;
}

.alert-info {
    background: #e8f4fd;
    color: #1a5fa8;
    border: 1px solid #b3d4f5;
}

/* ===== PROGRESS ===== */
.progress-wrap {
    max-width: 640px;
    margin: 20px auto;
    display: none;
}

.progress-wrap.active { display: block; }

.progress-bar-bg {
    background: var(--border);
    border-radius: 20px;
    height: 8px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 20px;
    width: 0%;
    transition: width 0.3s;
    animation: progress-anim 1.5s ease-in-out infinite;
}

@keyframes progress-anim {
    0% { width: 20%; }
    50% { width: 80%; }
    100% { width: 95%; }
}

.progress-text {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 8px;
}

/* ===== CANVAS ASSINATURA ===== */
#signature-canvas {
    border: 2px solid var(--border);
    border-radius: 12px;
    cursor: crosshair;
    background: white;
    display: block;
    margin: 0 auto;
    touch-action: none;
}

/* ===== BACK LINK ===== */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    margin-bottom: 32px;
    transition: color 0.2s;
}

.back-link:hover { color: var(--primary); }

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
    .tools-grid {
        grid-template-columns: 1fr;
    }

    .hero {
        padding: 48px 0 36px;
    }

    .hero h1 {
        font-size: 1.8rem;
    }

    .nav { display: none; }
}
