/* ==============================================
   SimpleMoney Tools - Shared page styles
   File: /css/tools.css
   Loaded after /css/styles.css by every page under
   /services/<topic>/ that is NOT a Crypto page (see
   /css/crypto.css for that family). Shared across every
   tool batch (Image, PDF, Text, Converters, ...) so a
   new batch only needs its own HTML, not its own CSS.
   ============================================== */

:root {
    --smo-bg: #f7f8fa;
    --smo-card: #ffffff;
    --smo-line: #e2e6ec;
    --smo-text: #1f2430;
    --smo-muted: #6b7280;
    --smo-primary: #2563eb;
    --smo-primary-ink: #ffffff;
    --smo-accent: #2563eb;
    --smo-ok: #16a34a;
    --smo-warn: #d97706;
    --smo-error: #dc2626;
    --smo-radius: 12px;
}

/* ---------- layout ---------- */

.tools-main {
    max-width: 1100px;
    margin: auto;
    padding: 40px 20px 80px;
    color: var(--smo-text);
}

.tools-head {
    margin-bottom: 24px;
}

.tools-head h1 {
    font-size: 2rem;
    margin: 0 0 10px;
}

.tools-head p {
    color: var(--smo-muted);
    line-height: 1.7;
    max-width: 780px;
    margin: 0;
}

.tools-breadcrumb {
    font-size: 13px;
    color: var(--smo-muted);
    margin-bottom: 14px;
}

.tools-breadcrumb a {
    color: var(--smo-muted);
    text-decoration: none;
}

.tools-breadcrumb a:hover {
    text-decoration: underline;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 22px;
    align-items: start;
}

.tools-grid--wide {
    grid-template-columns: 1fr;
}

/* ---------- cards ---------- */

.card {
    background: var(--smo-card);
    border: 1px solid var(--smo-line);
    border-radius: var(--smo-radius);
    padding: 22px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, .05);
}

.card h2 {
    font-size: 1.1rem;
    margin: 0 0 4px;
}

.card__hint {
    color: var(--smo-muted);
    font-size: 13px;
    margin: 0 0 18px;
    line-height: 1.6;
}

/* ---------- forms ---------- */

.field {
    margin-bottom: 16px;
}

.field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

.field small {
    display: block;
    color: var(--smo-muted);
    font-size: 12px;
    margin-top: 5px;
    line-height: 1.5;
}

.field input[type="text"],
.field input[type="number"],
.field input[type="range"],
.field select,
.field textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid var(--smo-line);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: var(--smo-text);
}

.field input[type="range"] {
    padding: 0;
}

.field textarea {
    min-height: 120px;
    resize: vertical;
}

.field textarea.tall {
    min-height: 280px;
}

.field textarea.mono {
    font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
    font-size: 13px;
    line-height: 1.5;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--smo-accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.field-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.field-row > .field {
    flex: 1 1 150px;
}

.checks {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.checks label {
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

/* ---------- buttons ---------- */

.btn {
    display: inline-block;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    background: #eef1f5;
    color: var(--smo-text);
}

.btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.btn--primary {
    background: var(--smo-primary);
    color: var(--smo-primary-ink);
}

.btn--primary:hover:enabled {
    filter: brightness(1.08);
}

.btn--ghost {
    background: transparent;
    border-color: var(--smo-line);
    color: var(--smo-muted);
}

.btn--link {
    background: transparent;
    color: var(--smo-accent);
    padding: 2px 6px;
    text-decoration: underline;
}

.btn--sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn--danger {
    background: var(--smo-error);
    color: #fff;
}

.btn-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 6px;
}

/* ---------- dropzone / file input ---------- */

.dropzone {
    border: 2px dashed var(--smo-line);
    border-radius: var(--smo-radius);
    background: var(--smo-bg);
    padding: 34px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}

.dropzone:hover,
.dropzone.is-dragover {
    border-color: var(--smo-accent);
    background: #eef2ff;
}

.dropzone__icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.dropzone__title {
    font-weight: 600;
    margin-bottom: 4px;
}

.dropzone__hint {
    color: var(--smo-muted);
    font-size: 12.5px;
}

.dropzone input[type="file"] {
    display: none;
}

.file-list {
    list-style: none;
    margin: 14px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--smo-bg);
    border: 1px solid var(--smo-line);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
}

.file-list__name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-list__size {
    color: var(--smo-muted);
    font-size: 12px;
    white-space: nowrap;
}

.file-list__remove {
    background: none;
    border: none;
    color: var(--smo-muted);
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    padding: 2px 4px;
}

.file-list__remove:hover {
    color: var(--smo-error);
}

/* ---------- preview ---------- */

.preview {
    text-align: center;
}

.preview img,
.preview canvas {
    max-width: 100%;
    max-height: 420px;
    border-radius: 8px;
    border: 1px solid var(--smo-line);
    background:
        linear-gradient(45deg, #eee 25%, transparent 25%),
        linear-gradient(-45deg, #eee 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #eee 75%),
        linear-gradient(-45deg, transparent 75%, #eee 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

.preview-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.preview-pair__label {
    font-size: 12px;
    color: var(--smo-muted);
    text-transform: uppercase;
    letter-spacing: .4px;
    margin-bottom: 6px;
    text-align: center;
}

@media (max-width: 640px) {
    .preview-pair {
        grid-template-columns: 1fr;
    }
}

/* ---------- status / notices ---------- */

.status {
    display: none;
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 13.5px;
    line-height: 1.6;
    background: #eef2ff;
    color: #1e3a8a;
    word-break: break-word;
}

.status.ok {
    background: #ecfdf5;
    color: #065f46;
}

.status.error {
    background: #fef2f2;
    color: #991b1b;
}

.status.warn {
    background: #fffbeb;
    color: #92400e;
}

.notice {
    padding: 12px 14px;
    border-left: 4px solid var(--smo-warn);
    background: #fffbeb;
    color: #92400e;
    border-radius: 6px;
    font-size: 13.5px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.notice--info {
    border-left-color: var(--smo-accent);
    background: #eef2ff;
    color: #1e3a8a;
}

/* ---------- data display ---------- */

.stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.stat {
    background: var(--smo-card);
    border: 1px solid var(--smo-line);
    border-radius: var(--smo-radius);
    padding: 16px;
}

.stat__label {
    font-size: 12px;
    color: var(--smo-muted);
    text-transform: uppercase;
    letter-spacing: .4px;
}

.stat__value {
    font-size: 1.35rem;
    font-weight: 700;
    margin-top: 6px;
    word-break: break-word;
}

.kv {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.kv th,
.kv td {
    text-align: left;
    padding: 9px 6px;
    border-bottom: 1px solid var(--smo-line);
    vertical-align: top;
}

.kv th {
    width: 42%;
    color: var(--smo-muted);
    font-weight: 500;
}

.kv td {
    word-break: break-word;
}

.swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.swatch {
    width: 64px;
    text-align: center;
    cursor: pointer;
}

.swatch__chip {
    width: 64px;
    height: 44px;
    border-radius: 8px;
    border: 1px solid var(--smo-line);
}

.swatch__code {
    font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
    font-size: 11px;
    margin-top: 4px;
    color: var(--smo-muted);
}

.progress {
    height: 10px;
    background: #eef1f5;
    border-radius: 20px;
    overflow: hidden;
    margin: 10px 0 6px;
}

.progress__bar {
    height: 100%;
    background: var(--smo-primary);
    width: 0;
    transition: width .3s ease;
}

.mono {
    font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
    font-size: 12.5px;
}

.code-out {
    width: 100%;
    box-sizing: border-box;
    min-height: 200px;
    font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
    font-size: 12.5px;
    line-height: 1.55;
    padding: 14px;
    border: 1px solid var(--smo-line);
    border-radius: 8px;
    background: #0f172a;
    color: #e2e8f0;
    white-space: pre-wrap;
    word-break: break-word;
    overflow: auto;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge--ok {
    background: #dcfce7;
    color: #166534;
}

.badge--warn {
    background: #fef3c7;
    color: #92400e;
}

.badge--error {
    background: #fee2e2;
    color: #991b1b;
}

.badge--muted {
    background: #eef1f5;
    color: var(--smo-muted);
}

.empty {
    color: var(--smo-muted);
    font-size: 13.5px;
    padding: 18px 0;
}

/* ---------- toasts ---------- */

.tools-toasts {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 340px;
}

.tools-toast {
    background: #1f2430;
    color: #fff;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 13.5px;
    line-height: 1.55;
    box-shadow: 0 6px 20px rgba(15, 23, 42, .25);
    word-break: break-word;
}

.tools-toast--success {
    background: #065f46;
}

.tools-toast--error {
    background: #991b1b;
}

.tools-toast--warn {
    background: #92400e;
}

/* ---------- related tools ---------- */

.related-tools {
    margin-top: 40px;
}

.related-tools h2 {
    font-size: 1.1rem;
    margin: 0 0 14px;
}

.related-tools__list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.related-tools__list a {
    display: inline-block;
    padding: 8px 14px;
    border: 1px solid var(--smo-line);
    border-radius: 20px;
    font-size: 13px;
    color: var(--smo-text);
    text-decoration: none;
    background: var(--smo-card);
}

.related-tools__list a:hover {
    border-color: var(--smo-accent);
    color: var(--smo-accent);
}

/* ---------- responsive ---------- */

@media (max-width: 640px) {

    .tools-main {
        padding: 24px 14px 60px;
    }

}
