/* ===========================
   Design system comum
   =========================== */

:root {
    --primary: #4361ee;
    --primary-dark: #3a56d4;
    --secondary: #7209b7;
    --accent: #4cc9f0;
    --success: #38b000;
    --warning: #f72585;
    --light: #f8f9fa;
    --dark: #212529;
    --gray: #6c757d;
    --border: #dee2e6;
    --shadow-soft: 0 4px 10px rgba(15, 23, 42, 0.12);
    --shadow-strong: 0 18px 45px rgba(15, 23, 42, 0.25);
    --radius-lg: 16px;
    --radius-xl: 20px;
}

/* Reset base */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
        Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: radial-gradient(circle at top, #f5f7ff 0, #e4edf5 40%, #d9e2f2 100%);
    color: var(--dark);
    line-height: 1.6;
    min-height: 100vh;
}

/* Wrapper genérico para páginas single tool e playground */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ===========================
   Header comum
   =========================== */

header,
.header {
    background: white;
    border-radius: var(--radius-xl);
    padding: 30px 24px;
    box-shadow: var(--shadow-soft);
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
}

header::before,
.header::before {
    content: "";
    position: absolute;
    inset: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent), var(--secondary));
}

header h1,
.header h1 {
    color: var(--primary);
    font-size: 2.4rem;
    font-weight: 800;
    margin-bottom: 10px;
}

.subtitle {
    color: var(--gray);
    font-size: 1.05rem;

}

/* header extra para playground */

.playground-hero {
    text-align: center;
    padding-top: 20px;
    padding-bottom: 10px;
}

.playground-hero h1 {
    font-size: 3rem;
}

.tagline {
    margin-top: 10px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 600;
    font-size: 1.1rem;
}

/* ===========================
   Cartões e painéis
   =========================== */

.tool-card,
.config-panel,
.result-panel,
.content {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

/* Playground cards */

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-top: 30px;
}

.tool-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.tool-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.22);
}

.card-header {
    padding: 24px 24px 12px;
    border-bottom: 1px solid var(--border);
}

.card-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    font-size: 1.8rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--dark);
}

.card-description {
    color: var(--gray);
    font-size: 0.95rem;
}

.card-body {
    padding: 18px 24px;
    flex-grow: 1;
}

.card-features {
    list-style: none;
}

.card-features li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 4px 0;
    font-size: 0.92rem;
    color: var(--gray);
}

.card-features li::before {
    content: "✓";
    color: var(--success);
    font-weight: 700;
}

.card-footer {
    padding: 0 24px 22px;
    margin-top: auto;
}

/* Coming Soon Ribbons */

.coming-soon {
    position: relative;
    overflow: hidden;
}

.coming-soon::after {
    content: "Coming Soon";
    position: absolute;
    top: 18px;
    right: -26px;
    background: var(--warning);
    color: white;
    padding: 4px 26px;
    transform: rotate(45deg);
    font-size: 0.78rem;
    font-weight: 700;
}

/* Badges de idioma (PT / EN) */
.lang-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.45rem;
    padding: 0.1rem 0.55rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: #e5e7eb; /* fallback neutro */
    color: #111827;
}

/* Badge PT */
.lang-badge.lang-pt {
    background: rgba(239, 68, 68, 0.12); /* vermelho suave */
    color: #b91c1c;
    border: 1px solid rgba(185, 28, 28, 0.25);
}

/* Badge EN */
.lang-badge.lang-en {
    background: rgba(59, 130, 246, 0.12); /* azul suave */
    color: #1d4ed8;
    border: 1px solid rgba(29, 78, 216, 0.25);
}

/* Meta text (descrição pequena por baixo do card-title) */
.card-meta {
    margin-top: 4px;
    font-size: 0.78rem;
    color: var(--gray, #6b7280);
}

/* ===========================
   Layout de duas colunas (ATS)
   =========================== */

.app-container {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
}

.config-panel,
.result-panel {
    padding: 22px 24px 24px;
    min-width: 320px;
}

.config-panel {
    flex: 1;
}

.result-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Forms e controlos */

.control-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--dark);
    font-size: 0.92rem;
}

input[type="text"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    font-size: 0.95rem;
    transition: border 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    background: #f8fafc;
}

input[type="text"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.25);
    background: white;
}

.checkbox-section {
    margin-top: 10px;
}

.checkbox-section h3 {
    font-size: 1rem;
    margin-bottom: 8px;
    color: var(--primary);
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
    max-height: 260px;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #f8fafc;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 8px;
    transition: background 0.15s ease;
}

.checkbox-item:hover {
    background: rgba(67, 97, 238, 0.05);
}

.checkbox-item input {
    transform: scale(1.15);
}

.checkbox-item label {
    margin: 0;
    font-weight: 400;
}

.select-all {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 6px;
}

.select-all button {
    background: transparent;
    border: none;
    color: var(--primary);
    font-size: 0.85rem;
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
}

/* Query result */

.query-result {
    margin-top: 10px;
    flex: 1;
}

textarea#generated-query {
    height: 230px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
        "Liberation Mono", "Courier New", monospace;
    font-size: 0.85rem;
    background: #f8fafc;
}

.query-stats {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.82rem;
    color: var(--gray);
}

.preview {
    margin-top: 18px;
    padding: 12px 14px;
    border-radius: 10px;
    background: #e9f0ff;
    font-size: 0.9rem;
}

.preview h3 {
    margin-bottom: 6px;
    color: var(--primary);
}

/* ===========================
   Gerador de Ditados
   =========================== */

.content {
    padding: 22px 24px 26px;
}

.generator {
    text-align: center;
    margin-bottom: 22px;
}

.ditado-display {
    background: #f8fafc;
    border: 3px dashed var(--primary);
    border-radius: 18px;
    padding: 26px 20px;
    margin: 18px 0 10px;
    font-size: 1.5rem;
    color: #1f2933;
    font-weight: 700;
    min-height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.4;
    word-break: break-word;
}

.status-message {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 0.9rem;
    display: none;
}

.share-buttons,
.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin: 16px 0;
}

/* URL info */

.url-info {
    text-align: center;
    margin-top: 8px;
    padding: 10px 12px;
    background: #eef2ff;
    border-radius: 10px;
    font-size: 0.85rem;
    color: #4b5563;
}

/* Historic */

.history {
    margin-top: 26px;
}

.history h2 {
    font-size: 1.1rem;
    margin-bottom: 10px;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 6px;
}

.history-list {
    max-height: 210px;
    overflow-y: auto;
    padding: 8px;
    border-radius: 12px;
    background: #f8fafc;
}

.history-item {
    background: white;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
    border-left: 4px solid var(--secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.history-meta {
    margin-top: 4px;
    font-size: 0.78rem;
    color: var(--gray);
}

/* ===========================
   Buttons
   =========================== */

button,
.btn {
    border: none;
    border-radius: 999px;
    padding: 10px 18px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease,
        background 0.15s ease, opacity 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    box-shadow: 0 6px 16px rgba(67, 97, 238, 0.35);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary), #9d4edd);
    color: white;
    box-shadow: 0 6px 16px rgba(114, 9, 183, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #4ade80);
    color: white;
    box-shadow: 0 6px 16px rgba(22, 163, 74, 0.3);
}

button:hover,
.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.25);
}

button:active,
.btn:active {
    transform: translateY(0);
    box-shadow: none;
}

/* ===========================
   Common Footer
   =========================== */

.footer {
    text-align: center;
    padding: 24px 16px 18px;
    color: var(--gray);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
    margin-top: 30px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: var(--radius-lg);
}

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

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

/* ===========================
   Utils
   =========================== */

.hidden {
    display: none;
}

.location-hint {
    font-size: 0.82rem;
    color: var(--gray);
    margin-top: 4px;
}

/* ===========================
   Responsive design
   =========================== */

@media (max-width: 768px) {

    header,
    .header {
        padding: 22px 18px;
        border-radius: 18px;
    }

    .playground-hero h1 {
        font-size: 2.3rem;
    }

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

    .app-container {
        flex-direction: column;
    }

    .share-buttons .btn,
    .controls .btn {
        width: 100%;
        max-width: 280px;
    }
}