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

:root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --surface-hover: #232733;
    --border: #2a2e3a;
    --text: #e4e6eb;
    --text-muted: #8b8fa3;
    --primary: #4f8cff;
    --primary-hover: #3a7af0;
    --green: #34d399;
    --green-bg: rgba(52, 211, 153, 0.1);
    --red: #f87171;
    --red-bg: rgba(248, 113, 113, 0.1);
    --yellow: #fbbf24;
    --yellow-bg: rgba(251, 191, 36, 0.1);
    --warning: #f59e0b;
    --radius: 10px;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

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

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

header h1 {
    font-size: 1.6rem;
    font-weight: 700;
}

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

.header-actions {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-warning {
    background: var(--warning);
    color: #000;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}

.btn-danger {
    background: var(--red);
    color: #fff;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-success {
    background: var(--green);
    color: #000;
}

.btn-success:hover {
    background: #10b981;
}

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

.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-available .stat-value {
    color: var(--green);
}

.stat-unavailable .stat-value {
    color: var(--red);
}

.stat-watched .stat-value {
    color: var(--yellow);
}

.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 4px;
    width: fit-content;
}

.tab {
    padding: 10px 24px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
}

.tab.active {
    background: var(--primary);
    color: #fff;
}

.tab:hover:not(.active) {
    color: var(--text);
}

.tab-content {
    display: none;
}

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

.toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.toolbar input,
.toolbar select {
    padding: 10px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.9rem;
}

.toolbar input {
    flex: 1;
    min-width: 200px;
}

.toolbar input:focus,
.toolbar select:focus {
    outline: none;
    border-color: var(--primary);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.product-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: all 0.2s;
}

.product-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.product-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.product-name {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
}

.product-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
}

.badge-available {
    background: var(--green-bg);
    color: var(--green);
}

.badge-unavailable {
    background: var(--red-bg);
    color: var(--red);
}

.product-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.meta-item {
    font-size: 0.85rem;
}

.meta-item .label {
    color: var(--text-muted);
}

.meta-item .value {
    font-weight: 600;
}

.product-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.product-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
}

.product-link:hover {
    text-decoration: underline;
}

.watchlist-header {
    margin-bottom: 20px;
}

.watchlist-header h2 {
    font-size: 1.3rem;
    margin-bottom: 6px;
}

.watchlist-header p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.watchlist-grid {
    display: grid;
    gap: 12px;
}

.watchlist-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    gap: 16px;
    flex-wrap: wrap;
}

.watchlist-info {
    flex: 1;
    min-width: 200px;
}

.watchlist-name {
    font-weight: 600;
    margin-bottom: 4px;
}

.watchlist-detail {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 24px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
    z-index: 1000;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.success {
    background: var(--green);
    color: #000;
}

.toast.error {
    background: var(--red);
    color: #fff;
}

.toast.info {
    background: var(--primary);
    color: #fff;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state h3 {
    margin-bottom: 8px;
    color: var(--text);
}

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

    header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-actions {
        width: 100%;
    }

    .header-actions .btn {
        flex: 1;
    }
}

.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: var(--shadow);
}

.login-card h1 {
    font-size: 1.6rem;
    margin-bottom: 8px;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 24px;
}

.login-card input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.95rem;
    margin-bottom: 16px;
}

.login-card input[type="password"]:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-full {
    width: 100%;
}

.login-error {
    color: var(--red);
    font-size: 0.85rem;
    margin-top: 12px;
    min-height: 20px;
}
