/* ===== Material Symbols ===== */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* ===== Template Design Utilities ===== */
.gradient-bg {
    background: linear-gradient(135deg, #000000, #0f172a, #581c87);
}

.gradient-text {
    background: linear-gradient(to right, #ff00ff, #8a2be2, #00bfff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    display: inline-block;
}

.headline-bg {
    background-color: rgba(0, 0, 0, 0.7);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

h1.gradient-text.headline-bg {
    text-shadow: none;
}

/* ===== Section Cards ===== */
.tool-card,
.bg-surface-container-low {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
}

.tool-card:hover,
.bg-surface-container-low.glow-box:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    border-color: rgba(138, 43, 226, 0.3);
}

.glow-box {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

/* ===== FAQ Accordion ===== */
.faq-item {
    border: 1px solid #e5e7eb;
    border-radius: var(--radius);
    padding: 16px 20px;
    background: #f9fafb;
    transition: all 0.3s ease;
}

.faq-item:hover {
    border-color: rgba(138, 43, 226, 0.3);
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.faq-item .faq-icon {
    color: #8b5cf6 !important;
}

/* ===== Collapsible Navigation ===== */
.collapse-nav {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.collapse-nav.open {
    max-height: 2000px;
}

.collapse-trigger {
    cursor: pointer;
    user-select: none;
}

.collapse-arrow {
    transition: transform 0.3s ease;
    display: inline-block;
}

.collapse-arrow.open {
    transform: rotate(180deg);
}

/* ===== Mobile Nav ===== */
.mobile-nav {
    background: #fff;
    border-color: #e5e7eb;
}

.header-bar {
    height: 64px;
}

.mobile-nav .border-t { border-color: #e5e7eb; }

.hamburger-btn {
    border: none;
    background: transparent;
    cursor: pointer;
}

.hamburger-spacer {
    visibility: hidden;
}

@media (min-width: 768px) {
    .hamburger-btn { display: none; }
    .hamburger-spacer { display: none; }
}

/* ===== Download Button ===== */
.download-btn {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 14px 36px;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #ec4899, #8b5cf6, #3b82f6);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 2px 12px rgba(139, 92, 246, 0.3);
}

.download-btn:hover:not(:disabled) {
    box-shadow: 0 2px 32px rgba(139, 92, 246, 0.4);
    transform: scale(1.03);
    background: linear-gradient(135deg, #f472b6, #a78bfa, #60a5fa);
}

.download-btn:active:not(:disabled) {
    transform: scale(0.97);
}

.download-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.download-btn .material-symbols-outlined {
    font-size: 20px;
}

/* ===== Converter Controls ===== */
.converter-controls {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* ===== Status Toast ===== */
.status-toast {
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    padding: 12px 20px;
    border-radius: var(--radius);
    transition: opacity 0.3s ease;
}

.status-toast.ok { background: #ecfdf5; color: #065f46; }
.status-toast.warn { background: #fffbeb; color: #92400e; }
.status-toast.error { background: #fef2f2; color: #991b1b; }

/* ===== Share Buttons ===== */
#shareBar { position: relative; }

.share-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.share-btn:hover {
    transform: translateY(-2px) scale(1.1);
    border-color: #8b5cf6;
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.2);
}

.share-btn .material-symbols-outlined { font-size: 25px; }
.share-btn .share-text { font-family: 'Sora', sans-serif; font-size: 23px; font-weight: 700; }
.share-btn.copied { background: #4caf50; color: #fff; border-color: #4caf50; }

#shareBar .share-btn[data-platform="copy"] { background: #7c3aed; color: #fff; border-color: #7c3aed; }
#shareBar .share-btn[data-platform="x"] { background: #1a1a1a; color: #fff; border-color: #444; }
#shareBar .share-btn[data-platform="facebook"] { background: #2563eb; color: #fff; border-color: #2563eb; }
#shareBar .share-btn[data-platform="reddit"] { background: #ea580c; color: #fff; border-color: #ea580c; }

.share-toast {
    position: absolute;
    top: -48px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Sora', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    background: #333;
    padding: 8px 18px;
    border-radius: var(--radius);
    opacity: 0;
    pointer-events: none;
    white-space: nowrap;
    transition: opacity 0.3s ease;
}

.share-toast.show { opacity: 1; }

/* ===== Footer ===== */
footer.gradient-bg {
    border-top-color: rgba(139, 92, 246, 0.2) !important;
}

footer .gradient-text {
    font-size: 24px;
    font-weight: 700;
}

/* ================================================================ */
/*  PRESET GALLERY — 9-card grid on home page                        */
/* ================================================================ */

.preset-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

@media (max-width: 768px) {
    .preset-gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }
}

@media (max-width: 480px) {
    .preset-gallery {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

.preset-card {
    position: relative;
    border: 2px solid #e5e7eb;
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafafa;
    aspect-ratio: 1;
}

.preset-card:hover {
    border-color: #8b5cf6;
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.15);
}

.preset-card.active {
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.3), 0 8px 25px rgba(139, 92, 246, 0.2);
}

.preset-card-preview {
    width: 100%;
    height: calc(100% - 48px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.preset-card-preview svg {
    width: 100%;
    height: 100%;
}

.preset-card-label {
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    background: #fff;
    border-top: 1px solid #f3f4f6;
    letter-spacing: 0.02em;
    text-align: center;
    padding: 0 8px;
}

.preset-card.active .preset-card-label {
    background: linear-gradient(135deg, #7c3aed, #8b5cf6);
    color: #fff;
}

/* ================================================================ */
/*  WORKSPACE — shown after preset activation                        */
/* ================================================================ */

#workspace {
    display: none;
}

#workspace.visible {
    display: block;
}

.workspace-grid {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    width: 100%;
    padding: 8px;
    background: #fafafa;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius);
    overflow: auto;
}

.workspace-grid-inner {
    display: grid;
    position: relative;
    width: 100%;
}

.workspace-grid-inner.h-strip-mode {
    overflow-x: auto;
    overflow-y: hidden;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    width: 100%;
    aspect-ratio: 16 / 9;
    align-items: stretch;
    touch-action: pan-x;
}

.workspace-grid-inner.h-strip-mode .grid-cell {
    flex-shrink: 0;
    height: 100%;
    touch-action: pan-x;
}

.workspace-grid-inner.v-strip-mode {
    overflow: visible;
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    width: 100%;
    align-items: stretch;
}

.workspace-grid-inner.v-strip-mode .grid-cell {
    flex-shrink: 0;
    width: 100%;
}

/* ===== Grid Cell ===== */
.grid-cell {
    position: relative;
    border: 1px dashed #d1d5db;
    background: #f9fafb;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
    min-width: 60px;
    min-height: 60px;
    user-select: none;
    touch-action: none;
}

.grid-cell:hover {
    border-color: #8b5cf6;
    background: rgba(139, 92, 246, 0.03);
}

.grid-cell.drag-over {
    border-color: #7c3aed;
    border-style: solid;
    background: rgba(139, 92, 246, 0.08);
    box-shadow: inset 0 0 0 2px rgba(124, 58, 237, 0.3);
}

.grid-cell.filled {
    border: 0;
}

.grid-cell.dragging-source {
    opacity: 0.4;
}

.grid-cell.selected {
    border-color: #7c3aed;
    border-style: solid;
    border-width: 2px;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.25);
}

.grid-cell.selected .grid-cell-remove {
    opacity: 1;
}

.grid-cell-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    pointer-events: none;
    width: 100%;
    height: 100%;
}

.grid-cell-number {
    font-family: 'Inter', sans-serif;
    font-size: 96px;
    font-weight: 700;
    color: #d1d5db;
    line-height: 1;
    user-select: none;
}

.grid-cell-icon {
    font-size: 44px !important;
    color: #c4b5fd;
    user-select: none;
}

@media (max-width: 640px) {
    .grid-cell-number {
        font-size: 48px;
    }
    .grid-cell-icon {
        font-size: 28px !important;
    }
}

.grid-cell img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.grid-cell-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 33px;
    height: 33px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    font-size: 21px;
    line-height: 1;
    transition: all 0.2s ease;
    opacity: 0;
}

.grid-cell:hover .grid-cell-remove {
    opacity: 1;
}

.grid-cell-remove:hover {
    background: #ef4444;
}

/* ===== Drag Ghost ===== */
.drag-ghost {
    position: fixed;
    pointer-events: none;
    z-index: 200;
    opacity: 0.85;
    border: 2px solid #7c3aed;
    border-radius: var(--radius);
    box-shadow: 0 8px 30px rgba(124, 58, 237, 0.3);
    overflow: hidden;
    background: #fff;
    transform: translate(-50%, -50%);
}

.drag-ghost img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ===== Controls Panel ===== */
.controls-panel {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px;
    padding: 16px 20px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius);
}

.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-label {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    font-family: 'JetBrains Mono', monospace;
}

.control-slider {
    width: 200px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #e5e7eb;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.control-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #7c3aed;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.control-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #7c3aed;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.control-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    min-width: 32px;
    text-align: right;
}

/* Oversize toast */
.oversize-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #dc2626;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    padding: 12px 28px;
    border-radius: var(--radius);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(220, 38, 38, 0.4);
}

.oversize-toast.show {
    opacity: 1;
}

/* ===== Tool Grid (team.php) ===== */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px 16px;
}

.tool-item {
    display: flex;
    flex-direction: column;
}

.tool-desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: #6b7280;
}

@media (max-width: 900px) {
    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===== Responsive workspace ===== */
@media (max-width: 640px) {
    .controls-panel {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px 12px;
        padding: 12px 14px;
    }

    .controls-panel .control-group:last-child {
        grid-column: 1 / -1;
        justify-self: end;
    }

    .control-slider {
        width: 100%;
        min-width: 0;
    }

    .workspace-grid {
        padding: 8px;
    }
}
