/* Shared theme, shell and components. Page layouts live in each tool stylesheet. */
[data-tool-root] { display: contents; }


:root {
    --primary: #4849E8;
    --primary-light: #6869FF;
    --primary-dark: #3C3DF2;

    --secondary: #ff6b9d;
    --secondary-light: #ff94b8;
    --secondary-dark: #ff4980;

    --accent: #00e5ff;
    --accent-light: #6effff;
    --accent-dark: #00b3cc;

    --bg-primary: #0a0a0a;
    --bg-secondary: #141414;
    --bg-tertiary: #181818;
    --bg-quaternary: #1e1e1e;

    --text-primary: #e9ecef;
    --text-secondary: #ced4da;
    --text-tertiary: #adb5bd;

    --border-color: #444;
    --border-light: #333;

    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #17a2b8;
    --green: #34d399;
    --red: #f87171;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.25);

    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    --transition: all 0.2s ease;
    --transition-slow: all 0.3s ease;

    --header-height: 70px;
    --sidebar-width: 320px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: YekanBakh, Tahoma, sans-serif;
    font-weight: 300;
}

body {
    --mouse-x: 50%;
    --mouse-y: 50%;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    background-image: radial-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px);
    background-size: 15px 15px;
    background-position: 0 0;
    direction: rtl;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    isolation: isolate;
}

.click-burst {
    position: fixed;
    z-index: 20;
    width: 0;
    height: 0;
    pointer-events: none;
}

.click-burst i {
    position: absolute;
    width: var(--size);
    height: var(--size);
    left: 0;
    top: 0;
    border-radius: 1px;
    background: rgba(185, 187, 255, .92);
    box-shadow: 0 0 8px rgba(104, 105, 255, .58);
    transform: translate(-50%, -50%);
    animation: click-burst .62s cubic-bezier(.2, .72, .32, 1) var(--delay) both;
}

@keyframes click-burst {
    0% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0deg); }
    65% { opacity: .86; }
    100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(.15) rotate(130deg); }
}

body > * {
    position: relative;
    z-index: 1;
}



html,
body {
    height: 100%;
}

header {
    background: var(--bg-secondary);
    padding: 10px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    z-index: 10;
    backdrop-filter: blur(8px);
}

.header-content {
    display: flex;
    flex-direction: row;
    gap: 40px;
    align-items: center;
}

.logo-section {
    display: flex;
    gap: 10px;
    align-items: center;
}

.logo-section img {
    width: 50px;
}

.logo-section h1 {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.menu {
    display: flex;
    gap: 10px;
}

.menu a {
    text-decoration: none;
    color: white;
    padding: 8px 14px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    gap: 5px;
}

.menu button {
    color: white;
    padding: 8px 14px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 10px;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    display: flex;
    gap: 5px;
    width: auto;
    margin: 0;
    box-shadow: none;
}

.menu button:hover,
.menu a:hover {
    background: var(--primary);
}

.popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: none;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(2px);
    animation: fadeIn 0.3s ease;
    z-index: 10;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.display-flex {
    display: flex;
}

.popup-box {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 12px;
    text-align: right;
    color: var(--text-primary);
    transform: translateY(-20px);
    animation: slideDown 0.3s ease forwards;
}

.tools-link {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 20px 0;
}

@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.popup-box a {
    padding: 8px 0;
    color: white;
    background: var(--bg-tertiary);
    text-decoration: none;
    transition: 0.2s;
    border-radius: 10px;
    padding: 10px 20px;
    display: flex;
    gap: 10px;
    flex-direction: row-reverse;
    justify-content: space-between;
}

.close-popup {
    width: 100%;
    margin-top: 10px;
    padding: 8px;
    border: none;
    border-radius: 6px;
    background: var(--primary);
    color: var(--text-primary);
    cursor: pointer;
    transition: 0.3s;
}

.close-popup:hover {
    background: var(--primary-light);
}

footer {
    text-align: center;
    padding: 16px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.875rem;
    position: relative;
    width: 100%;
    margin-top: auto;
    backdrop-filter: blur(8px);
}

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

::-webkit-scrollbar-track {
    background: #1d1d1d;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: none;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #1d1d1d;
}

* {
    scrollbar-width: thin;
    scrollbar-color: #1d1d1d #1d1d1d;
}

label {
    display: flex;
    margin-bottom: 8px;
    font-weight: 300;
    color: var(--text-primary);
    font-size: 0.875rem;
    justify-content: space-between;
}

input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border-color);
    outline: none;
    -webkit-appearance: none;
    margin-bottom: 16px;
    transition: var(--transition);
}

input[type="range"]:hover {
    background: var(--primary-light);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    border: 2px solid var(--primary-light);
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

select,
button {
    padding: 12px 16px;
    border: none;
    border-radius: var(--radius-md);
    background-color: var(--bg-tertiary);
    font-size: 0.875rem;
    margin-bottom: 12px;
    font-family: inherit;
    transition: var(--transition);
    color: var(--text-primary);
    cursor: pointer;
}

select {
    background-color: var(--bg-tertiary);
    background-size: 20px;
    background-position: left 10px center;
    background-repeat: no-repeat;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-left: 40px;
}

select:hover,
select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(72, 73, 232, 0.2);
}

button:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

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

.range-value {
    display: inline-block;
    min-width: 40px;
    text-align: center;
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 300;
    font-size: 0.75rem;
}

.toggle-container {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
    gap: 12px;
}

.toggle-label {
    font-weight: 300;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch .slider,
.toggle-switch .toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: 0.4s;
    border-radius: 24px;
}

.toggle-switch .slider:before,
.toggle-switch .toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    top: 3px;
    bottom: 2px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

.toggle-switch input:checked+.slider,
.toggle-switch input:checked+.toggle-slider {
    background-color: var(--primary);
}
s
.toggle-switch input:checked+.slider:before,
.toggle-switch input:checked+.toggle-slider:before {
    transform: translateX(26px);
}

@media (max-width: 768px) {
    header {
        padding: 0 16px;
        height: auto;
        min-height: var(--header-height);
        flex-wrap: wrap;
        gap: 12px;
        padding: 10px 16px;
    }

    .header-content {
        text-align: right;
        width: 100%;
    }

    select,
    button {
        padding: 10px 12px;
        font-size: 0.8rem;
    }

    .control-group h3 {
        font-size: 1rem;
    }

    label {
        font-size: 0.8rem;
    }
}

@media (max-width: 576px) {
    header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .header-content {
        width: 100%;
        text-align: center;
    }
}


input[type="color"].cp-applied {
    display: none !important;
}

.cp-color-box {
    display: inline-block;
    width: 45px;
    height: 45px;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease;
    vertical-align: middle;
}

.cp-popup {
    position: fixed;
    background: var(--bg-secondary, #222);
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    width: 250px;
    z-index: 999999;
    display: none;
    flex-direction: column;
    gap: 15px;
    border: 1px solid #333;
    font-family: sans-serif;
}

.cp-popup.cp-active {
    display: flex;
}

.cp-sv-area {
    width: 100%;
    height: 150px;
    position: relative;
    border-radius: 8px;
    cursor: crosshair;
    background-color: #ff0000;
    overflow: hidden;
}

.cp-sv-white {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to right, #fff, rgba(255,255,255,0));
}

.cp-sv-black {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to top, #000, rgba(0,0,0,0));
}

.cp-sv-cursor {
    position: absolute;
    width: 14px;
    height: 14px;
    border: 2px solid white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 4px rgba(0,0,0,0.5);
    pointer-events: none;
}

.cp-hue-slider {
    width: 100%;
    height: 16px;
    position: relative;
    border-radius: 8px;
    cursor: pointer;
    background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
}

.cp-hue-cursor {
    position: absolute;
    width: 16px;
    height: 20px;
    background: white;
    border-radius: 4px;
    transform: translate(-50%, -2px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
    pointer-events: none;
}

.cp-hex-wrapper {
    display: flex;
    align-items: center;
    background: var(--bg-tertiary, #111);
    border-radius: 6px;
    padding: 5px 10px;
    border: 1px solid #444;
}

.cp-hex-wrapper span {
    color: #888;
    margin-right: 5px;
}

.cp-hex-wrapper input {
    background: transparent;
    border: none;
    color: white;
    font-size: 16px;
    width: 100%;
    outline: none;
    text-transform: uppercase;
    font-family: monospace;
}

.cp-popup { direction: ltr; max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); overflow: auto; }
.cp-sv-area, .cp-hue-slider { touch-action: none; user-select: none; }
.cp-color-box { padding: 0; flex-shrink: 0; border: 1px solid var(--border-color); }
.cp-color-box:focus-visible, .cp-popup :focus-visible { outline: 2px solid var(--primary-light); outline-offset: 3px; }
.cp-close { background: var(--bg-tertiary); color: var(--text-primary); border: 1px solid var(--border-color); border-radius: var(--radius-sm); cursor: pointer; padding: 5px; }
.cp-hex-wrapper input[aria-invalid="true"] { color: var(--danger); }

.tools-toast {
    position: fixed; top: max(16px, env(safe-area-inset-top)); left: 50%; z-index: 999999;
    display: flex; align-items: center; gap: 12px; width: max-content;
    max-width: min(420px, calc(100vw - 32px)); padding: 14px 18px;
    border: 0; border-radius: 14px; color: var(--text-primary, #f8fafc);
    background: var(--bg-secondary, #171923);
    box-shadow: 0 18px 55px rgba(0,0,0,.48); direction: rtl; text-align: right;
    pointer-events: none; opacity: 0; visibility: hidden;
    transform: translate(-50%,-16px) scale(.97);
    transition: opacity .22s ease, transform .22s ease, visibility .22s;
}
.tools-toast.is-visible { opacity: 1; visibility: visible; transform: translate(-50%,0) scale(1); }
.tools-toast.is-success { --toast-accent: #22c55e; --toast-tint: rgba(34,197,94,.16); }
.tools-toast.is-error { --toast-accent: #ef4444; --toast-tint: rgba(239,68,68,.16); }
.tools-toast.is-warning { --toast-accent: #eab308; --toast-tint: rgba(234,179,8,.16); }
.tools-toast-icon {
    display: block; flex: 0 0 38px; width: 38px; height: 38px; padding: 4px;
    box-sizing: border-box; overflow: visible; border: 0; border-radius: 50%;
    color: var(--toast-accent); background: var(--toast-tint);
    fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.tools-toast-icon .toast-ring, .tools-toast-icon .toast-mark {
    stroke-dasharray: 80; stroke-dashoffset: 80;
}
.tools-toast-icon .toast-ring { stroke-width: 1.25; }
.tools-toast-icon .toast-mark { stroke-width: 2; }
.tools-toast.is-visible .tools-toast-icon .toast-ring { animation: tools-toast-draw .78s ease-in-out forwards; }
.tools-toast.is-visible .tools-toast-icon .toast-mark { animation: tools-toast-draw .88s .58s ease-in-out forwards; }
@keyframes tools-toast-draw { to { stroke-dashoffset: 0; } }
.tools-toast-message { line-height: 1.7; }
@media (prefers-reduced-motion: reduce) { .tools-toast { transition: opacity .01ms, visibility .01ms; transform: translate(-50%,0); } .tools-toast-icon, .tools-toast-icon * { animation: none !important; stroke-dashoffset: 0 !important; } }
