/* 
 * Ozon Minimum Price Switch Batch Tool Styling System (Cloudflare Workers Edition)
 * Modern glassmorphism dark theme palette
 */

:root {
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --bg-card-border: rgba(255, 255, 255, 0.08);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --primary-color: #005bff; /* Ozon Signature Blue */
    --primary-hover: #0046c7;
    --accent-color: #6366f1;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.35);
}

/* Bright Theme Overrides */
body.light-theme {
    --bg-dark: #f1f5f9;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-card-border: rgba(0, 0, 0, 0.08);
    --text-main: #0f172a;
    --text-muted: #64748b;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    padding: 24px;
    background-image: 
        radial-gradient(at 10% 20%, rgba(0, 91, 255, 0.12) 0px, transparent 50%),
        radial-gradient(at 90% 80%, rgba(99, 102, 241, 0.12) 0px, transparent 50%);
    background-attachment: fixed;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.app-container {
    max-width: 1360px;
    margin: 0 auto;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.brand .logo-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #fff;
    margin-right: 16px;
    box-shadow: 0 4px 20px rgba(0, 91, 255, 0.4);
}

.brand h1 {
    font-size: 1.4rem;
    font-weight: 700;
}

.subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.flex-align-center { display: flex; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 12px; }

/* Cards & Glassmorphism */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    padding: 20px;
    margin-bottom: 20px;
}

.card-header {
    padding-bottom: 14px;
    border-bottom: 1px solid var(--bg-card-border);
    margin-bottom: 18px;
}

.card-header h3 {
    font-size: 1.05rem;
    font-weight: 600;
}

/* Grids */
.grid-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 992px) {
    .grid-main { grid-template-columns: 1fr; }
}

.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Form Controls */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

input[type="text"],
input[type="password"],
input[type="number"],
textarea {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--bg-card-border);
    background: rgba(15, 23, 42, 0.4);
    color: var(--text-main);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s ease;
}

body.light-theme input,
body.light-theme textarea {
    background: rgba(255, 255, 255, 0.9);
}

input:focus, textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 91, 255, 0.25);
}

/* Buttons */
.btn {
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-primary { background: var(--primary-color); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }

.btn-secondary { background: var(--accent-color); color: #fff; }
.btn-secondary:hover { opacity: 0.9; }

.btn-success { background: var(--success-color); color: #fff; }
.btn-success:hover { filter: brightness(1.1); transform: translateY(-1px); }

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}
.btn-outline:hover { background: rgba(0, 91, 255, 0.1); }

.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--danger-color); }

.btn-icon { width: 38px; height: 38px; padding: 0; border-radius: 50%; }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 14px; font-size: 1rem; }
.btn-block { width: 100%; }

/* Tab Navigation */
.tab-nav {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--bg-card-border);
    padding-bottom: 10px;
    margin-bottom: 16px;
}

.tab-btn {
    padding: 8px 14px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn.active {
    background: rgba(0, 91, 255, 0.15);
    color: var(--primary-color);
    font-weight: 600;
}

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

/* Drag and Drop Zone */
.drop-zone {
    border: 2px dashed rgba(0, 91, 255, 0.4);
    border-radius: var(--radius-md);
    padding: 30px 20px;
    text-align: center;
    background: rgba(0, 91, 255, 0.03);
    cursor: pointer;
    transition: all 0.2s ease;
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--primary-color);
    background: rgba(0, 91, 255, 0.08);
}

.drop-icon {
    font-size: 2.2rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.drop-text span {
    color: var(--primary-color);
    text-decoration: underline;
    font-weight: 600;
}

.template-bar {
    margin-top: 12px;
    font-size: 0.8rem;
}

/* Radio Group */
.radio-toggle-group {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.radio-label { cursor: pointer; flex: 1; }
.radio-label input { display: none; }
.radio-btn {
    display: block;
    text-align: center;
    padding: 8px;
    font-size: 0.82rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--bg-card-border);
    background: rgba(15, 23, 42, 0.3);
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.radio-label input:checked + .radio-enable { background: rgba(16, 185, 129, 0.2); border-color: var(--success-color); color: var(--success-color); font-weight: 600; }
.radio-label input:checked + .radio-disable { background: rgba(239, 68, 68, 0.2); border-color: var(--danger-color); color: var(--danger-color); font-weight: 600; }
.radio-label input:checked + .radio-keep { background: rgba(99, 102, 241, 0.2); border-color: var(--accent-color); color: var(--accent-color); font-weight: 600; }

.global-setting-box {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px dashed var(--bg-card-border);
}

.timer-refresh-banner {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.timer-icon-box {
    width: 44px;
    height: 44px;
    min-width: 44px;
    background: linear-gradient(135deg, #10b981, #059669);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.timer-text-box h4 {
    font-size: 0.96rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 3px;
}

.timer-text-box p {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-sm);
    padding: 12px;
    text-align: center;
}

.stat-num { font-size: 1.5rem; font-weight: 700; display: block; }
.stat-label { font-size: 0.78rem; color: var(--text-muted); }

.stat-success .stat-num { color: var(--success-color); }
.stat-danger .stat-num { color: var(--danger-color); }

/* Progress Bar */
.progress-bar-container {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--success-color));
    transition: width 0.3s ease;
}

.progress-text { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 14px; }

/* Console Logs */
.console-box {
    background: #090d16;
    color: #38bdf8;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.82rem;
    padding: 12px;
    border-radius: var(--radius-sm);
    height: 220px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.console-line { margin-bottom: 4px; line-height: 1.4; word-break: break-all; }
.console-success { color: #4ade80; }
.console-error { color: #f87171; }
.console-warning { color: #fbbf24; }

/* Data Table */
.table-responsive { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
}

.data-table th {
    background: rgba(15, 23, 42, 0.6);
    padding: 12px;
    text-align: left;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--bg-card-border);
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--bg-card-border);
}

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-success { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }

.app-footer {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 30px;
}

.text-accent { color: var(--accent-color); }
.text-muted { color: var(--text-muted); }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
