:root {
    --bg: #0b1224;
    --panel: rgba(15, 23, 42, 0.9);
    --card: #0f172a;
    --card-strong: #111c34;
    --border: #1f2a44;
    --muted: #94a3b8;
    --text: #e2e8f0;
    --accent: #22d3ee;
    --accent-2: #f59e0b;
    --danger: #ef4444;
    --success: #10b981;
    --shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Space Grotesk", "Sora", "DM Sans", -apple-system, system-ui, sans-serif;
    background: radial-gradient(circle at 15% 20%, rgba(34, 211, 238, 0.08), transparent 25%),
        radial-gradient(circle at 85% 10%, rgba(245, 158, 11, 0.08), transparent 22%),
        radial-gradient(circle at 50% 90%, rgba(14, 165, 233, 0.1), transparent 30%),
        var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding: 28px 18px 48px;
}

.page {
    max-width: 1200px;
    margin: 0 auto;
}

.glass {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.hero {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 22px;
    padding: 24px;
    margin-bottom: 18px;
}

.hero h1 {
    margin: 10px 0;
    font-size: 32px;
    letter-spacing: -0.4px;
}

.hero p {
    margin: 8px 0 16px;
    color: var(--muted);
    line-height: 1.5;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(34, 211, 238, 0.12);
    color: #8bf0ff;
    border: 1px solid rgba(34, 211, 238, 0.25);
    border-radius: 999px;
    font-weight: 600;
    font-size: 13px;
}

.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.tag {
    padding: 6px 10px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 13px;
    color: var(--muted);
}

.hero-panel {
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.2), rgba(15, 23, 42, 0.7));
    border: 1px solid rgba(34, 211, 238, 0.35);
    border-radius: 14px;
    padding: 18px;
}

.hero-panel h3 {
    margin: 0 0 8px;
    font-size: 18px;
}

.hero-panel p {
    margin: 0 0 12px;
    color: var(--muted);
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.hero-stat {
    padding: 14px;
    border-radius: 12px;
    background: rgba(11, 18, 36, 0.6);
    border: 1px solid var(--border);
}

.hero-stat small {
    display: block;
    color: var(--muted);
    margin-bottom: 6px;
}

.hero-stat strong {
    font-size: 18px;
}

.workspace {
    padding: 18px;
}

.tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.tab {
    padding: 12px 14px;
    background: rgba(17, 24, 39, 0.8);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    letter-spacing: -0.2px;
    transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.tab:hover {
    transform: translateY(-2px);
    border-color: rgba(34, 211, 238, 0.5);
    box-shadow: 0 10px 25px rgba(34, 211, 238, 0.15);
}

.tab.active {
    background: linear-gradient(120deg, rgba(34, 211, 238, 0.25), rgba(245, 158, 11, 0.2));
    border-color: rgba(245, 158, 11, 0.6);
    color: #fef3c7;
}

.panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 14px;
}

.panel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 14px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.section-heading h2 {
    margin: 0;
    font-size: 20px;
}

.muted {
    color: var(--muted);
    font-size: 14px;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 700;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 11px 12px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: rgba(34, 211, 238, 0.8);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15);
}

.file-upload {
    border: 2px dashed rgba(34, 211, 238, 0.4);
    border-radius: 12px;
    padding: 28px;
    text-align: center;
    background: rgba(11, 18, 36, 0.6);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.12s ease;
}

.file-upload:hover {
    border-color: rgba(245, 158, 11, 0.6);
    background: rgba(34, 211, 238, 0.05);
    transform: translateY(-1px);
}

.file-upload.drag-over {
    border-color: rgba(34, 211, 238, 0.9);
    background: rgba(34, 211, 238, 0.08);
}

.file-upload input {
    display: none;
}

.file-upload-icon {
    font-size: 42px;
    margin-bottom: 10px;
}

.file-info {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(34, 211, 238, 0.08);
    border: 1px dashed rgba(34, 211, 238, 0.35);
    display: none;
}

.file-info.show {
    display: block;
}

.btn {
    width: 100%;
    padding: 13px 16px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.9), rgba(245, 158, 11, 0.9));
    color: #0b1224;
    font-weight: 800;
    letter-spacing: -0.1px;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.2s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(34, 211, 238, 0.22);
}

.btn:active {
    transform: translateY(0);
}

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

.btn.secondary {
    background: rgba(17, 24, 39, 0.8);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn.danger {
    background: linear-gradient(120deg, rgba(239, 68, 68, 0.9), rgba(248, 113, 113, 0.85));
    color: #fff5f5;
}

.progress {
    margin-top: 10px;
    display: none;
}

.progress.show {
    display: block;
}

.progress-bar {
    width: 100%;
    height: 26px;
    background: rgba(15, 23, 42, 0.8);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, rgba(34, 211, 238, 0.9), rgba(245, 158, 11, 0.9));
    width: 0%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0b1224;
    font-weight: 700;
    transition: width 0.25s ease;
}

.alert {
    padding: 12px 14px;
    border-radius: 12px;
    margin: 10px 0;
    display: none;
    border-left: 4px solid transparent;
    font-weight: 700;
}

.alert.show {
    display: block;
}

.alert-success {
    background: rgba(16, 185, 129, 0.12);
    color: #bbf7d0;
    border-color: var(--success);
}

.alert-error {
    background: rgba(239, 68, 68, 0.12);
    color: #fecdd3;
    border-color: var(--danger);
}

.spinner {
    border: 4px solid rgba(148, 163, 184, 0.25);
    border-top: 4px solid var(--accent);
    border-radius: 50%;
    width: 42px;
    height: 42px;
    animation: spin 0.9s linear infinite;
    margin: 14px auto;
    display: none;
}

.spinner.show {
    display: block;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.result {
    margin-top: 14px;
    display: none;
}

.result.show {
    display: block;
}

.result-image {
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.result-info {
    margin-top: 10px;
    padding: 12px;
    border-radius: 12px;
    background: rgba(11, 18, 36, 0.7);
    border: 1px solid var(--border);
}

.thumbnail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
    margin-top: 10px;
}

.thumbnail-item {
    background: rgba(15, 23, 42, 0.8);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: transform 0.15s ease, border-color 0.2s ease;
    position: relative;
}

.thumbnail-item:hover {
    transform: translateY(-2px);
    border-color: rgba(34, 211, 238, 0.6);
}

.thumbnail-item img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.thumbnail-item-info {
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 14px;
}

.thumbnail-item-title {
    font-weight: 700;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lightbox {
    display: none;
    position: fixed;
    z-index: 2000;
    padding-top: 50px;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
}

.lightbox-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 85vh;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.lightbox-close {
    position: absolute;
    top: 18px;
    right: 30px;
    color: #f1f1f1;
    font-size: 38px;
    font-weight: bold;
    cursor: pointer;
}

#lightbox-caption {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 680px;
    text-align: center;
    color: var(--muted);
    padding: 14px 0;
    font-size: 16px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.info-card {
    padding: 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--card-strong);
}

.list-note {
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
}

.storage-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.inline-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}

@media (max-width: 700px) {
    body {
        padding: 20px 14px 32px;
    }

    .tabs {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
}
