/* ==========================================================================
   Web Tools — shared design system
   Loaded on every page BEFORE the page-specific stylesheet.
   ========================================================================== */

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

:root {
    --bg: #faf7fd;
    --bg-alt: #ffffff;
    --text: #241f33;
    --text-muted: #6b6480;
    --card-bg: #ffffff;
    --card-border: rgba(124, 58, 237, 0.10);
    --shadow: rgba(124, 58, 237, 0.14);
    --shadow-strong: rgba(124, 58, 237, 0.24);

    --primary: #7c3aed;
    --secondary: #ec4899;
    --tertiary: #f97316;

    --accent-gradient: linear-gradient(135deg, #7c3aed 0%, #ec4899 55%, #f97316 100%);
    --brand-gradient: linear-gradient(90deg, #7c3aed, #ec4899, #f97316, #facc15, #22d3ee);
    --success: #16a34a;

    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;

    --font-heading: 'Poppins', 'Segoe UI', sans-serif;
    --font-body: 'Inter', 'Segoe UI', sans-serif;
    --font-mono: 'Consolas', 'Monaco', monospace;

    --icon-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b6480' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

/* Icon shapes for mask-based (currentColor-aware) icons */
:root {
    --icon-moon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z'/%3E%3C/svg%3E");
    --icon-sun: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4'/%3E%3C/svg%3E");
    --icon-shield: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3l7 3v6c0 4.5-3 7.5-7 9-4-1.5-7-4.5-7-9V6z'/%3E%3C/svg%3E");
    --icon-globe: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M3 12h18M12 3c2.5 2.7 4 6 4 9s-1.5 6.3-4 9c-2.5-2.7-4-6-4-9s1.5-6.3 4-9z'/%3E%3C/svg%3E");
    --icon-bolt: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M13 2L3 14h7l-1 8 11-14h-7l0-6z'/%3E%3C/svg%3E");
    --icon-upload: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 16V4M12 4l-4 4M12 4l4 4'/%3E%3Cpath d='M4 16v3a2 2 0 002 2h12a2 2 0 002-2v-3'/%3E%3C/svg%3E");
    --icon-copy: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='9' width='11' height='11' rx='2'/%3E%3Cpath d='M5 15V5a2 2 0 012-2h10'/%3E%3C/svg%3E");

    /* white variants for use as background-image on gradient badges */
    --icon-shield-w: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3l7 3v6c0 4.5-3 7.5-7 9-4-1.5-7-4.5-7-9V6z'/%3E%3C/svg%3E");
    --icon-globe-w: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M3 12h18M12 3c2.5 2.7 4 6 4 9s-1.5 6.3-4 9c-2.5-2.7-4-6-4-9s1.5-6.3 4-9z'/%3E%3C/svg%3E");
    --icon-bolt-w: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M13 2L3 14h7l-1 8 11-14h-7l0-6z'/%3E%3C/svg%3E");
}

body.dark-mode {
    --bg: #140f20;
    --bg-alt: #1c1530;
    --text: #f1eef9;
    --text-muted: #b3a9c9;
    --card-bg: #1f1833;
    --card-border: rgba(255, 255, 255, 0.08);
    --shadow: rgba(0, 0, 0, 0.35);
    --shadow-strong: rgba(0, 0, 0, 0.5);

    --primary: #a78bfa;
    --secondary: #f472b6;
    --tertiary: #fb923c;

    --accent-gradient: linear-gradient(135deg, #a78bfa 0%, #f472b6 55%, #fb923c 100%);
    --brand-gradient: linear-gradient(90deg, #a78bfa, #f472b6, #fb923c, #fde047, #67e8f9);

    --icon-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b3a9c9' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

html {
    scroll-behavior: smooth;
}

body {
    position: relative;
    overflow-x: hidden;
    font-family: var(--font-body);
    color: var(--text);
    background-color: var(--bg);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    align-items: center;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Decorative blurred blobs behind every page */
body::before,
body::after {
    content: "";
    position: fixed;
    border-radius: 50%;
    filter: blur(90px);
    z-index: -1;
    opacity: 0.28;
    pointer-events: none;
}

body::before {
    width: 480px;
    height: 480px;
    top: -140px;
    left: -140px;
    background: var(--primary);
}

body::after {
    width: 420px;
    height: 420px;
    bottom: -160px;
    right: -120px;
    background: var(--tertiary);
}

h1, h2, h3, h4 {
    font-family: var(--font-heading);
}

a {
    color: var(--primary);
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--brand-gradient);
    border-radius: 999px;
}

/* ---------------- Header ---------------- */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    background-color: color-mix(in srgb, var(--card-bg) 85%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 2px solid transparent;
    border-image: var(--brand-gradient) 1;
    box-shadow: 0 4px 16px var(--shadow);
}

.header-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 64px;
    padding: 10px 24px;
}

.logo {
    font-size: 1.6em;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1;
}

.logo a,
.logo {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
}

.logo a {
    display: inline-block;
    transition: transform 0.25s ease;
}

.logo a:hover {
    transform: translateY(-1px) scale(1.02);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

#theme-toggle {
    background: var(--bg-alt);
    border: 1px solid var(--card-border);
    font-size: 0;
    line-height: 1;
    cursor: pointer;
    color: var(--primary);
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#theme-toggle::before {
    content: "";
    display: block;
    width: 19px;
    height: 19px;
    background-color: currentColor;
    -webkit-mask: var(--icon-moon) center / contain no-repeat;
    mask: var(--icon-moon) center / contain no-repeat;
}

body.dark-mode #theme-toggle::before {
    -webkit-mask-image: var(--icon-sun);
    mask-image: var(--icon-sun);
}

#theme-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px var(--shadow);
}

.language-switcher {
    position: relative;
    display: inline-block;
}

#languageIcon {
    width: 28px;
    cursor: pointer;
    border-radius: 999px;
    padding: 6px;
    background: var(--bg-alt);
    border: 1px solid var(--card-border);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-sizing: content-box;
}

#languageIcon:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px var(--shadow);
}

.language-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    box-shadow: 0 10px 24px var(--shadow-strong);
    padding: 8px;
    border-radius: var(--radius-sm);
    z-index: 1;
    display: none;
    gap: 6px;
}

.language-menu img {
    width: 26px;
    margin: 2px;
    cursor: pointer;
    border-radius: 4px;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.language-menu img:hover {
    opacity: 0.75;
    transform: scale(1.08);
}

/* ---------------- Main / containers ---------------- */
main {
    flex: 1;
    width: 100%;
    max-width: 1200px;
    padding: 40px 20px 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
}

.info-section {
    text-align: center;
    color: var(--text-muted);
    max-width: 700px;
    font-size: 1.05em;
}

/* ---------------- Page header (replaces boxed intro text) ---------------- */
.page-header {
    width: 100%;
    max-width: 760px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 4px 20px 0;
}

.page-header h1 {
    font-size: 2.1em;
    font-weight: 800;
    line-height: 1.15;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.page-header p {
    color: var(--text-muted);
    font-size: 1.05em;
    line-height: 1.6;
    max-width: 620px;
}

/* ---------------- Split layout (two panels side by side) ---------------- */
.split-layout {
    width: 100%;
    max-width: 1100px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
    align-items: start;
}

.panel {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 26px var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--card-border);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.95em;
    color: var(--text);
}

.panel-header .dot-row {
    display: flex;
    gap: 6px;
}

.panel-header .dot-row span {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--card-border);
}

.panel-body {
    padding: 18px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

@media (max-width: 900px) {
    .split-layout {
        grid-template-columns: 1fr;
    }
}

/* ---------------- Field grid (multi-field forms, e.g. crontab) ---------------- */
.field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    width: 100%;
}

.field-card {
    background: var(--bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
}

.field-card label {
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.field-card select,
.field-card input[type="text"] {
    width: 100%;
}

/* ---------------- Dropzone (file upload) ---------------- */
.dropzone {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 150px;
    padding: 24px;
    border: 2px dashed var(--card-border);
    border-radius: var(--radius-md);
    background: var(--bg);
    cursor: pointer;
    text-align: center;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.dropzone:hover {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 6%, var(--bg));
}

.dropzone .dropzone-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary);
    background-image: var(--icon-upload), var(--accent-gradient);
    background-repeat: no-repeat, no-repeat;
    background-position: center, center;
    background-size: 18px 18px, cover;
}

.dropzone .dropzone-text {
    font-weight: 600;
    color: var(--text);
}

.dropzone .dropzone-hint {
    font-size: 0.82em;
    color: var(--text-muted);
}

.dropzone input[type="file"] {
    max-width: 220px;
    border: none;
    background: transparent;
    padding: 0;
    font-size: 0.85em;
}

/* ---------------- Buttons & form elements ---------------- */
button,
.convert-btn,
.copy-button,
.play-btn,
.download-btn,
.tag,
.download-link {
    font-family: var(--font-body);
    font-weight: 600;
    padding: 11px 24px;
    background: var(--accent-gradient);
    color: #fff;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.95em;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 6px 16px var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

button:hover,
.convert-btn:hover,
.copy-button:hover,
.play-btn:hover,
.download-btn:hover,
.tag:hover,
.download-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px var(--shadow-strong);
    opacity: 1;
}

button:active {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

select,
input[type="text"],
input[type="file"] {
    font-family: var(--font-body);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--card-border);
    background: var(--bg-alt);
    color: var(--text);
    font-size: 0.95em;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

select {
    appearance: none;
    -webkit-appearance: none;
    background-image: var(--icon-chevron);
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 13px;
    padding-right: 40px;
    cursor: pointer;
}

select::-ms-expand {
    display: none;
}

select:focus,
input[type="text"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 20%, transparent);
}

select:hover,
input[type="text"]:hover {
    border-color: color-mix(in srgb, var(--primary) 45%, var(--card-border));
}

label {
    font-weight: 600;
    color: var(--text);
    font-size: 0.95em;
}

/* ---------------- Feature cards ---------------- */
.features-section,
.faq-section {
    background: var(--bg-alt);
    border: 1px solid var(--card-border);
    padding: 44px 24px;
    border-radius: var(--radius-lg);
    text-align: center;
    width: 100%;
    max-width: 1200px;
}

.features-section h2,
.faq-section h2 {
    font-size: 1.6em;
    margin-bottom: 28px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

.features-container {
    display: grid;
    gap: 22px;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    justify-items: center;
}

.feature-item {
    position: relative;
    background: var(--card-bg);
    padding: 32px 22px 22px;
    border-radius: var(--radius-md);
    box-shadow: 0 6px 20px var(--shadow);
    text-align: left;
    width: 100%;
    max-width: 320px;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.feature-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 30px var(--shadow-strong);
}

.feature-item::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: var(--brand-gradient);
    border-top-left-radius: var(--radius-md);
    border-top-right-radius: var(--radius-md);
}

.feature-item::after {
    content: "";
    position: absolute;
    top: -20px;
    left: 22px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary);
    background-image: var(--icon-shield-w), var(--accent-gradient);
    background-repeat: no-repeat, no-repeat;
    background-position: center, center;
    background-size: 18px 18px, cover;
    box-shadow: 0 6px 14px var(--shadow-strong);
}

.features-container .feature-item:nth-of-type(2)::after {
    background-image: var(--icon-globe-w), var(--accent-gradient);
}

.features-container .feature-item:nth-of-type(3)::after {
    background-image: var(--icon-bolt-w), var(--accent-gradient);
}

.feature-item p {
    color: var(--text);
    opacity: 0.9;
    margin: 0 0 6px 0;
    line-height: 1.5;
}

.feature-item p strong {
    font-family: var(--font-heading);
    font-size: 1.05em;
}

/* ---------------- FAQ ---------------- */
.faq-item {
    position: relative;
    margin-bottom: 16px;
    background: var(--card-bg);
    padding: 20px 24px 20px 56px;
    border-radius: var(--radius-md);
    box-shadow: 0 6px 16px var(--shadow);
    color: var(--text);
    text-align: left;
}

.faq-item::before {
    content: "?";
    position: absolute;
    top: 18px;
    left: 18px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-gradient);
    color: #fff;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.faq-item p {
    margin: 0;
    line-height: 1.5;
}

.faq-item p:first-child {
    margin-bottom: 6px;
    color: var(--primary);
}

/* ---------------- Footer ---------------- */
footer,
.footer {
    background: var(--bg-alt);
    border-top: 1px solid var(--card-border);
    color: var(--text-muted);
    width: 100%;
    padding: 22px 15px;
    text-align: center;
    font-size: 0.9em;
}

/* ---------------- Top button ---------------- */
#top-button {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 0;
    width: 48px;
    height: 48px;
    font-size: 18px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 8px 20px var(--shadow-strong);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.2s ease;
    z-index: 500;
}

#top-button.show {
    opacity: 1;
    pointer-events: auto;
}

#top-button:hover {
    transform: translateY(-3px);
}

/* ---------------- Notification ---------------- */
.notification {
    position: fixed;
    top: 24px;
    right: 24px;
    background: var(--success);
    color: white;
    padding: 12px 22px;
    border-radius: 999px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
    font-size: 14px;
    font-weight: 600;
    z-index: 1000;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.notification.show {
    opacity: 1;
    transform: translateY(0);
}

/* ---------------- Loading overlay ---------------- */
#loading-overlay {
    background: var(--bg, #140f20);
}

/* ---------------- Mobile ---------------- */
@media (max-width: 768px) {
    .feature-item {
        max-width: 90%;
    }

    main {
        gap: 20px;
        padding: 28px 16px 48px;
    }

    .features-section,
    .faq-section {
        padding: 32px 18px;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 1.3em;
    }

    button, .convert-btn, .copy-button {
        font-size: 14px;
        padding: 9px 18px;
    }

    .page-header h1 {
        font-size: 1.6em;
    }
}
