/* Shared Utility Deck Tools - Base Design System */

:root {
    --theme-bg: #090b0e;
    --theme-surface: #11151c;
    --theme-surface-hover: #19202b;
    --theme-border: #222c3d;
    --theme-border-highlight: #2f3d54;
    --theme-accent: #10b981;
    --theme-accent-glow: rgba(16, 185, 129, 0.35);
    --theme-accent-dim: rgba(16, 185, 129, 0.12);
    --theme-text: #f0f6fc;
    --theme-text-muted: #8b98a9;
    --theme-font-head: 'Comfortaa', -apple-system, sans-serif;
    --theme-font-body: 'Comfortaa', -apple-system, sans-serif;
    --theme-radius: 12px;
    --max-width: 900px;
}

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

body {
    background-color: var(--theme-bg);
    color: var(--theme-text);
    font-family: var(--theme-font-body);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Utilities */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.hidden {
    display: none !important;
}

.flex-1 {
    flex: 1;
}

.full-width {
    width: 100%;
}

.btn-primary.full-width,
.btn-secondary.full-width {
    width: 100%;
    display: flex;
    justify-content: center;
}

.text-center {
    text-align: center;
}

/* Background Overlay Grid */
.bg-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 32px 32px;
    pointer-events: none;
    z-index: 0;
}

/* App Shell Layout */
.app-shell {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 20px 16px 20px;
    position: relative;
    z-index: 1;
    flex: 1 0 auto;
}

/* Top Navigation Bar */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius);
    margin-bottom: 28px;
    gap: 16px;
    flex-wrap: wrap;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--theme-font-head);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--theme-text);
    text-decoration: none;
}

.nav-brand .brand-badge {
    color: var(--theme-accent);
    font-size: 0.8rem;
    background: var(--theme-accent-dim);
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    letter-spacing: 0.5px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-link {
    color: var(--theme-text-muted);
    text-decoration: none;
    font-size: 0.88rem;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.nav-link:hover {
    color: var(--theme-accent);
    border-color: var(--theme-border);
    background: var(--theme-surface-hover);
}

/* Tool Header */
.tool-header {
    margin-bottom: 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tool-icon-wrapper {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: var(--theme-accent-dim);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--theme-accent);
    margin-bottom: 12px;
}

.tool-header h1 {
    font-family: var(--theme-font-head);
    font-size: clamp(1.5rem, 3.2vw, 2.1rem);
    color: var(--theme-text);
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.tool-header .tool-desc {
    color: var(--theme-text-muted);
    font-size: 0.92rem;
    max-width: 520px;
}

/* Status & Security Badges */
.security-badge-row {
    margin-top: 12px;
}

.security-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #0d1117;
    border: 1px solid var(--theme-border);
    padding: 4px 14px;
    border-radius: 999px;
    font-size: 0.8rem;
    color: var(--theme-text-muted);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #0d1117;
    border: 1px solid var(--theme-border);
    padding: 4px 14px;
    border-radius: 999px;
    font-size: 0.8rem;
    color: var(--theme-text-muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--theme-accent);
    box-shadow: 0 0 8px var(--theme-accent);
}

/* Panels */
.tool-panel {
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius);
    padding: 24px 28px;
    margin-bottom: 24px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

.panel-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.panel-title {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--theme-text);
    margin-bottom: 18px;
}

.panel-header-row .panel-title {
    margin-bottom: 0;
}

/* Form Controls */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--theme-text-muted);
    margin-bottom: 8px;
}

.form-input, textarea {
    width: 100%;
    background: #0b0d12;
    border: 1px solid var(--theme-border);
    border-radius: 8px;
    padding: 12px 14px;
    color: var(--theme-text);
    font-family: var(--theme-font-body);
    font-size: 16px;
    line-height: 1.4;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    box-sizing: border-box;
}

.form-select, select {
    width: 100%;
    background-color: #0b0d12;
    border: 1px solid var(--theme-border);
    border-radius: 8px;
    padding: 12px 42px 12px 14px;
    color: var(--theme-text);
    font-family: var(--theme-font-body);
    font-size: 16px;
    line-height: 1.4;
    transition: border-color 0.2s, box-shadow 0.2s, background-image 0.2s;
    outline: none;
    box-sizing: border-box;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    /* Crisp SVG chevron-down vector */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%238b98a9' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px 16px;
}

.form-select:hover, select:hover {
    border-color: var(--theme-border-highlight);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23f0f6fc' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px 16px;
}

.form-input:focus, textarea:focus {
    border-color: var(--theme-accent);
    box-shadow: 0 0 0 2px var(--theme-accent-dim);
}

.form-select:focus, select:focus {
    border-color: var(--theme-accent);
    box-shadow: 0 0 0 2px var(--theme-accent-dim);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2310b981' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px 16px;
}

.form-select option, select option {
    background-color: #11151c;
    color: var(--theme-text);
    padding: 10px 14px;
}

/* Standard Buttons */
.btn-row {
    display: flex;
    gap: 12px;
}

.btn-primary {
    background: var(--theme-accent);
    color: #0b0d12;
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    font-family: var(--theme-font-head);
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    box-shadow: 0 0 16px var(--theme-accent-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #0b0d12;
    border: 1px solid var(--theme-border);
    color: var(--theme-text);
    padding: 12px 20px;
    border-radius: 8px;
    font-family: var(--theme-font-head);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    text-decoration: none;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.btn-secondary:hover {
    border-color: var(--theme-border-highlight);
    background: var(--theme-surface-hover);
    color: var(--theme-accent);
}

/* Upload Dropzone Primitives */
.upload-dropzone {
    border: 2px dashed var(--theme-border-highlight);
    border-radius: var(--theme-radius);
    padding: 48px 20px;
    text-align: center;
    background: #0d1117;
    transition: border-color 0.2s, background-color 0.2s;
    cursor: pointer;
}

.upload-dropzone:hover {
    border-color: var(--theme-accent);
    background: var(--theme-accent-dim);
}

.upload-icon-ring {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    color: var(--theme-accent);
}

.drop-title {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--theme-text);
    margin-bottom: 4px;
}

.drop-subtitle {
    color: var(--theme-text-muted);
    font-size: 0.85rem;
}

/* ==========================================================================
   Universal Mobile Anti-Zoom & Touch Safeguards (iOS Safari & Android)
   ========================================================================== */
html, body {
    touch-action: manipulation;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

input, select, textarea, button, a, label {
    touch-action: manipulation;
}

/* 
 * iOS Safari forces auto-zoom on any text box whose computed font-size is < 16px.
 * Strictly enforcing >= 16px prevents iOS Safari from ever zooming in on focus.
 */
@media screen and (max-width: 850px) {
    input,
    select,
    textarea,
    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="search"],
    input[type="password"],
    input[type="url"],
    input[type="tel"],
    .form-input,
    .form-select,
    .subtask-input,
    .stepper-input,
    .ambient-compact-select {
        font-size: 16px !important;
    }
}

