/* ========== THEME VARIABLES ========== */
:root {
    --bg: #f6f8fa;
    --card: #ffffff;
    --accent: #0ea5a8;
    --muted: #6b7280;
    --text: #0f172a;
    --border: #e6eef0;
}

html.dark {
    --bg: #1a1a2e;
    --card: #16213e;
    --accent: #0ea5a8;
    --muted: #9ca3af;
    --text: #e5e7eb;
    --border: #374151;
}

/* ========== GLOBAL STYLES ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, 'Helvetica Neue', Arial;
    background: var(--bg);
    color: var(--text);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background-color 300ms, color 300ms;
}

.main-content {
    flex: 1;
}

/* ========== NAVIGATION ========== */
nav {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
    transition: background-color 300ms, border-color 300ms;
}

nav .nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

nav a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    margin: 0 12px;
    transition: opacity 200ms;
}

nav a:hover {
    opacity: 0.8;
}

nav a.active {
    color: var(--accent);
    border-bottom: 2px solid var(--accent);
}

/* ========== THEME TOGGLE BUTTON ========== */
.theme-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background: var(--accent);
    color: #ffffff;
    font-size: 24px;
    cursor: pointer;
    transition: all 300ms;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(14, 165, 168, 0.3);
    z-index: 999;
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(14, 165, 168, 0.4);
}

html.dark .theme-toggle {
    box-shadow: 0 4px 12px rgba(14, 165, 168, 0.2);
}

/* ========== FOOTER ========== */
footer {
    background: var(--card);
    border-top: 1px solid var(--border);
    padding: 24px 0;
    margin-top: 48px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    transition: background-color 300ms, border-color 300ms;
}

footer .footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

footer p {
    margin: 8px 0;
}

/* ========== COMMON COMPONENTS ========== */
.container {
    max-width: 720px;
    margin: 48px auto;
    padding: 20px;
}

.container.wide-800 {
    max-width: 800px;
}

.container.wide-900 {
    max-width: 900px;
}

.card {
    background: var(--card);
    border-radius: 12px;
    padding: 28px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
    transition: background-color 300ms;
}

.card.margin-bottom {
    margin-bottom: 20px;
}

h1 {
    margin: 0 0 12px;
    font-size: 22px;
}

p.lead {
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 14px;
}

/* ========== TABS ========== */
.tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.tab {
    padding: 12px 16px;
    cursor: pointer;
    border: none;
    background: none;
    color: var(--muted);
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all 200ms;
}

.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-content {
    display: none;
}

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

/* ========== UPLOAD AREA ========== */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all 200ms;
    background: var(--card);
}

.upload-area:hover {
    border-color: var(--accent);
    background: #f8fafb;
}

.upload-area.dragover {
    border-color: var(--accent);
    background: #f0fbfc;
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.upload-input {
    display: none;
}

/* ========== FORM ELEMENTS ========== */
input[type="text"],
input[type="date"],
input[type="number"],
select {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    background: var(--card);
    color: var(--text);
    transition: all 200ms;
}

input[type="text"]:focus,
input[type="date"]:focus,
input[type="number"]:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
}

input[type="range"] {
    height: 6px;
    cursor: pointer;
}

.form-group {
    margin: 16px 0;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.quality-control {
    margin: 20px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.quality-control label {
    flex: 0 0 80px;
    font-weight: 500;
}

.quality-control input[type="range"] {
    flex: 1;
}

.quality-value {
    flex: 0 0 50px;
    font-weight: 600;
    color: var(--accent);
    text-align: right;
}

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

.control-group label {
    flex: 0 0 100px;
    font-weight: 500;
}

.control-group select,
.control-group input[type="range"] {
    flex: 1;
}

.control-value {
    flex: 0 0 60px;
    font-weight: 600;
    color: var(--accent);
    text-align: right;
}

.controls {
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ========== BUTTONS ========== */
button {
    background: var(--accent);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 15px;
    transition: all 200ms;
}

button:hover {
    opacity: 0.9;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.copy-btn {
    background: #022c2b;
    color: #b7fff8;
    padding: 8px 10px;
}

.copy-btn:hover {
    opacity: 0.8;
}

.remove-btn {
    background: #ff6b6b;
    color: white;
    padding: 6px 12px;
    font-size: 12px;
    width: auto;
}

/* ========== ALERTS ========== */
.error {
    background: #fee2e2;
    color: #b91c1c;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    border-left: 4px solid #b91c1c;
}

.success {
    background: #dcfce7;
    color: #166534;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    border-left: 4px solid #16a34a;
}

/* ========== PREVIEW & RESULTS ========== */
.preview {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.preview-item {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    background: #f0f0f0;
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-item .remove {
    position: absolute;
    top: 4px;
    right: 4px;
    background: #ff4444;
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    padding: 0;
    font-size: 12px;
    cursor: pointer;
}

.result {
    margin-top: 18px;
    padding: 14px;
    border-radius: 8px;
    background: #f8fafb;
    border: 1px dashed var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.result-label {
    color: var(--muted);
    font-size: 13px;
}

.result-value {
    color: var(--accent);
    font-weight: 600;
    font-size: 18px;
    margin-top: 8px;
}

.short-url {
    color: var(--accent);
    font-weight: 600;
}

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

.file-preview {
    margin-top: 16px;
    padding: 12px;
    background: #f8fafb;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: 500;
    margin-bottom: 4px;
}

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

.file-list {
    margin-top: 16px;
    max-height: 300px;
    overflow-y: auto;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f8fafb;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 13px;
}

/* ========== ADS ========== */
.ad-box {
    background: #f8fafb;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    min-height: 250px;
    margin-top: 16px;
}

/* ========== TOAST NOTIFICATIONS ========== */
#toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    background: #052e2d;
    color: #b7fff8;
    padding: 10px 14px;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(2, 12, 12, 0.2);
    z-index: 1000;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 600px) {
    nav a {
        margin: 0 6px;
        font-size: 12px;
    }

    .theme-toggle {
        width: 45px;
        height: 45px;
        bottom: 20px;
        right: 20px;
        font-size: 20px;
    }

    .container {
        margin: 20px auto;
    }

    .card {
        padding: 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    input[type="text"],
    input[type="date"] {
        width: 100%;
    }

    button {
        width: 100%;
    }

    form {
        flex-direction: column;
        align-items: stretch;
    }

    form input[type="text"],
    form input[type="date"] {
        width: 100%;
    }
}
