/* Salnea Price Watcher - Dashboard Styles */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --background: #f8fafc;
    --surface: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --sidebar-bg: #1e293b;
    --sidebar-text: #94a3b8;
    --sidebar-active: #ffffff;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.5;
}

/* Login */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

.login-box {
    background: var(--surface);
    padding: 3rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-logo {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.login-box h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.login-subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.login-form .form-group {
    margin-bottom: 1rem;
    text-align: left;
}

.login-form label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.login-form input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.error-message {
    color: var(--danger);
    font-size: 0.875rem;
    margin-top: 1rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

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

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

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #475569;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

.btn-icon {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    font-size: 1rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.btn-icon:hover {
    opacity: 1;
}

/* App Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 240px;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-header .logo {
    font-size: 1.5rem;
}

.sidebar-header .logo-text {
    color: white;
    font-weight: 600;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.2s;
}

.sidebar-nav a:hover {
    background: rgba(255,255,255,0.05);
    color: white;
}

.sidebar-nav a.active {
    background: rgba(255,255,255,0.1);
    color: var(--sidebar-active);
    border-left: 3px solid var(--primary);
}

.nav-icon {
    font-size: 1.25rem;
}

.nav-badge {
    margin-left: auto;
    background: rgba(255,255,255,0.2);
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
}

.nav-badge.alert {
    background: var(--danger);
    color: white;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.btn-logout {
    width: 100%;
    background: rgba(255,255,255,0.1);
    border: none;
    padding: 0.75rem;
    color: var(--sidebar-text);
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.15);
    color: white;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 240px;
    display: flex;
    flex-direction: column;
}

.main-header {
    background: var(--surface);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.main-header h1 {
    font-size: 1.25rem;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
}

.view-content {
    padding: 2rem;
    flex: 1;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-card.warning {
    border-left: 4px solid var(--warning);
}

.stat-card.success {
    border-left: 4px solid var(--success);
}

.stat-card.danger {
    border-left: 4px solid var(--danger);
}

.stat-icon {
    font-size: 2rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Cards */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

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

.card-body {
    padding: 1.5rem;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

/* Alerts List */
.alerts-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.alert-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--background);
    border-radius: var(--radius);
}

.alert-icon {
    font-size: 1.25rem;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 500;
    font-size: 0.875rem;
}

.alert-message {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.alert-time {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Competitors List */
.competitors-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.competitor-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
}

.competitor-name {
    font-weight: 500;
}

.competitor-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Filters Bar */
.filters-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.search-input {
    flex: 1;
    max-width: 300px;
    padding: 0.625rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.filter-select {
    padding: 0.625rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: white;
}

/* Table */
.table-container {
    overflow-x: auto;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: var(--background);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
}

.data-table tr:hover {
    background: var(--background);
}

.product-name {
    font-weight: 500;
}

.product-brand {
    font-size: 0.75rem;
    color: var(--text-muted);
}

code {
    background: var(--background);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

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

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.position-badge {
    font-size: 1.25rem;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
}

.pagination button {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius);
    cursor: pointer;
}

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

/* Alerts View */
.alerts-container {
    display: grid;
    gap: 1rem;
}

.alert-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.alert-card.unread {
    border-left: 4px solid var(--primary);
}

.alert-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.alert-type {
    font-weight: 600;
}

.alert-date {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.alert-body h4 {
    margin-bottom: 0.5rem;
}

.alert-body p {
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.alert-prices {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
}

.alert-actions {
    margin-top: 1rem;
}

/* Competitors Grid */
.competitors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

.competitor-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.competitor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.competitor-header h3 {
    font-size: 1rem;
}

.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-danger {
    background: #fef2f2;
    color: var(--danger);
}

.badge-neutral {
    background: var(--background);
    color: var(--text-muted);
}

.competitor-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    text-align: center;
}

.comp-stat .value {
    font-size: 1.25rem;
    font-weight: 700;
}

.comp-stat .label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.competitor-last-seen {
    margin-top: 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Scan View */
.scan-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.625rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.scan-result {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.scan-result:last-child {
    border-bottom: none;
}

.result-status {
    font-size: 1.25rem;
}

.result-name {
    flex: 1;
}

.result-price {
    font-weight: 600;
}

.result-error {
    color: var(--danger);
    font-size: 0.875rem;
}

/* Settings */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

.connection-status {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.connection-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
}

.status-ok {
    color: var(--success);
}

.status-error {
    color: var(--danger);
}

.status-completed {
    color: var(--success);
}

.status-running {
    color: var(--warning);
}

.status-failed {
    color: var(--danger);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.25rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-body {
    padding: 1.5rem;
}

.product-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

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

.detail-item .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.price-history {
    margin-top: 2rem;
}

.price-history h4,
.product-competitors h4 {
    margin-bottom: 1rem;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
}

.toast-success {
    background: var(--success);
    color: white;
}

.toast-error {
    background: var(--danger);
    color: white;
}

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

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Empty State */
.empty-state {
    color: var(--text-muted);
    text-align: center;
    padding: 2rem;
}

/* Utilities */
.mt-3 {
    margin-top: 1rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }
    
    .sidebar-header .logo-text,
    .nav-text,
    .nav-badge {
        display: none;
    }
    
    .sidebar-nav a {
        justify-content: center;
        padding: 1rem;
    }
    
    .main-content {
        margin-left: 60px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .filters-bar {
        flex-wrap: wrap;
    }
    
    .search-input {
        max-width: 100%;
    }
}
