/* ====================================
   TAXI PRICE COMPARISON — DESIGN SYSTEM
   Light Theme · Clean & Professional
   ==================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* --- CSS Variables (Light Theme) --- */
:root {
    --bg-page: #f5f7fb;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-input: #f0f2f7;
    --bg-input-focus: #ffffff;
    --bg-hover: #f0f2f7;
    --bg-active: #eef0ff;
    --bg-modal-overlay: rgba(30, 41, 59, 0.45);

    --border-light: #e2e6ef;
    --border-medium: #d0d5e0;
    --border-focus: #6366f1;

    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-dim: #cbd5e1;

    /* Brand accent — green */
    --accent-primary: #10b981;
    --accent-primary-light: #34d399;
    --accent-primary-bg: rgba(16, 185, 129, 0.08);
    --accent-primary-glow: rgba(16, 185, 129, 0.2);
    --accent-secondary: #059669;
    --accent-secondary-bg: rgba(5, 150, 105, 0.08);

    --accent-success: #10b981;
    --accent-success-bg: rgba(16, 185, 129, 0.1);
    --accent-warning: #f59e0b;
    --accent-warning-bg: rgba(245, 158, 11, 0.1);
    --accent-danger: #ef4444;
    --accent-danger-bg: rgba(239, 68, 68, 0.08);
    --accent-info: #06b6d4;
    --accent-info-bg: rgba(6, 182, 212, 0.08);

    --gradient-brand: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --gradient-brand-subtle: linear-gradient(135deg, rgba(16, 185, 129, 0.06), rgba(5, 150, 105, 0.04));
    --gradient-warm: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    --gradient-card-hover: linear-gradient(145deg, rgba(16, 185, 129, 0.03), transparent);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.04), 0 0 0 1px rgba(0, 0, 0, 0.02);

    --transition-fast: 0.15s ease;
    --transition-base: 0.25s ease;
    --transition-slow: 0.4s ease;

    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Subtle gradient background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 320px;
    background: linear-gradient(180deg, rgba(16, 185, 129, 0.05) 0%, transparent 100%);
    pointer-events: none;
    z-index: -1;
}

body::after {
    display: none;
}

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

/* --- Sidebar Navigation --- */
.sidebar {
    width: 240px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-light);
    padding: 1.25rem 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform var(--transition-base);
}

.sidebar-brand {
    padding: 0.25rem 1.25rem 1.25rem;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 0.75rem;
}

.sidebar-brand h1 {
    font-size: 1.55rem;
    font-weight: 800;
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.03em;
}

.sidebar-brand span {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: block;
    margin-top: 0.15rem;
}

.sidebar-nav {
    list-style: none;
    padding: 0 0.6rem;
    flex: 1;
}

.sidebar-nav li {
    margin-bottom: 2px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 0.85rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.sidebar-nav a:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar-nav a.active {
    background: var(--bg-active);
    color: var(--accent-primary);
    font-weight: 600;
}

.sidebar-nav a .icon {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    margin-left: 240px;
    padding: 1.75rem 2rem;
    min-height: 100vh;
}

.page-header {
    margin-bottom: 1.75rem;
}

.page-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

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

/* --- Cards --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-card);
    transition: all var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-sm);
}

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

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* --- Stat Cards --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0.85rem;
    margin-bottom: 1.75rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.15rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    box-shadow: var(--shadow-card);
    transition: all var(--transition-base);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.stat-icon.purple {
    background: var(--accent-primary-bg);
}

.stat-icon.green {
    background: var(--accent-success-bg);
}

.stat-icon.amber {
    background: var(--accent-warning-bg);
}

.stat-icon.cyan {
    background: var(--accent-info-bg);
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
}

/* --- Service Status --- */
.service-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.75rem;
}

.service-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    box-shadow: var(--shadow-xs);
    transition: all var(--transition-fast);
}

.service-card:hover {
    box-shadow: var(--shadow-sm);
}

.service-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    animation: pulse-dot 2s ease-in-out infinite;
}

.service-dot.online {
    background: var(--accent-success);
}

.service-dot.offline {
    background: var(--accent-danger);
    animation: none;
}

.service-dot.checking {
    background: var(--accent-warning);
}

@keyframes pulse-dot {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.service-name {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.service-status-text {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-left: auto;
    font-weight: 500;
}

.service-status-text.online {
    color: var(--accent-success);
}

.service-status-text.offline {
    color: var(--accent-danger);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.1rem;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--gradient-brand);
    color: white;
    box-shadow: 0 2px 8px var(--accent-primary-glow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px var(--accent-primary-glow);
    filter: brightness(1.05);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-medium);
}

.btn-danger {
    background: var(--accent-danger-bg);
    color: var(--accent-danger);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.15);
}

.btn-success {
    background: var(--accent-success-bg);
    color: var(--accent-success);
}

.btn-success:hover {
    background: rgba(16, 185, 129, 0.15);
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}

.btn-outline:hover {
    background: var(--bg-hover);
    border-color: var(--border-medium);
}

.btn-sm {
    padding: 0.35rem 0.7rem;
    font-size: 0.78rem;
}

.btn-lg {
    padding: 0.7rem 1.4rem;
    font-size: 0.95rem;
}

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

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

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.form-input {
    width: 100%;
    padding: 0.6rem 0.85rem;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.88rem;
    transition: all var(--transition-fast);
}

.form-input:focus {
    outline: none;
    background: var(--bg-input-focus);
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

.form-input::placeholder {
    color: var(--text-dim);
}

select.form-input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    padding-right: 2.5rem;
}

/* --- Tables --- */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

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

thead th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-input);
    border-bottom: 1px solid var(--border-light);
}

tbody td {
    padding: 0.75rem 1rem;
    font-size: 0.88rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
}

tbody tr:hover {
    background: var(--bg-hover);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* --- Price Display --- */
.price-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
}

.price-tag.positive {
    background: var(--accent-success-bg);
    color: var(--accent-success);
}

.price-tag.negative {
    background: var(--accent-danger-bg);
    color: var(--accent-danger);
}

.price-tag.neutral {
    background: var(--accent-info-bg);
    color: var(--accent-info);
}

/* --- Comparison Grid --- */
.comparison-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.comparison-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-card);
    transition: all var(--transition-base);
}

.comparison-card:hover {
    box-shadow: var(--shadow-md);
}

.comparison-card .company-name {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

.comparison-card .price-list {
    list-style: none;
}

.comparison-card .price-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.88rem;
}

.comparison-card .price-list li:last-child {
    border-bottom: none;
}

.comparison-card .vehicle-name {
    color: var(--text-secondary);
}

.comparison-card .vehicle-price {
    font-weight: 600;
    color: var(--text-primary);
}

/* --- Scrape Form --- */
.scrape-form {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1.75rem;
    box-shadow: var(--shadow-card);
}

.scrape-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto auto;
    gap: 0.85rem;
    align-items: end;
}

/* --- Calculator --- */
.calculator-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.calc-input-panel,
.calc-results-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-card);
}

.calc-result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-light);
}

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

.calc-company {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.calc-company-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.calc-vehicle-type {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.calc-diff {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.15rem;
}

.calc-diff-value {
    font-weight: 700;
    font-size: 1rem;
}

.calc-diff-pct {
    font-size: 0.72rem;
}

.cheaper {
    color: var(--accent-success);
}

.pricier {
    color: var(--accent-danger);
}

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

/* --- Settings --- */
.settings-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.25rem;
}

.group-list {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.group-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1.15rem;
    border-bottom: 1px solid var(--border-light);
}

.group-list-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
}

.group-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.15rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
    transition: all var(--transition-fast);
}

.group-item:hover {
    background: var(--bg-hover);
}

.group-item.active {
    background: var(--bg-active);
    border-left: 3px solid var(--accent-primary);
}

.group-item .group-name {
    font-weight: 500;
    font-size: 0.88rem;
}

.group-item .group-count {
    font-size: 0.72rem;
    color: var(--text-muted);
    background: var(--bg-input);
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-sm);
}

.url-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-card);
}

.url-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-light);
}

.url-item:last-child {
    border-bottom: none;
}

.url-info {
    flex: 1;
}

.url-name {
    font-weight: 500;
    font-size: 0.88rem;
    margin-bottom: 0.15rem;
}

.url-link {
    font-size: 0.78rem;
    color: var(--text-muted);
    word-break: break-all;
}

.url-actions {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
    margin-left: 0.85rem;
}

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-modal-overlay);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    width: 100%;
    max-width: 460px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px) scale(0.95);
    transition: all var(--transition-base);
}

/* Wide modal for URL form — two-column layout */
.modal.modal-wide {
    max-width: 700px;
}

.modal-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 1.25rem;
}

.modal-two-col .form-group-full {
    grid-column: 1 / -1;
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

.modal h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 1.15rem;
    color: var(--text-primary);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.65rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}

/* Modal header/footer used in progress */
.modal-header {
    margin-bottom: 1rem;
}

.modal-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-body {
    margin-bottom: 0.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

/* --- Loading States --- */
.loading-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-light);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

.skeleton {
    background: linear-gradient(90deg, var(--bg-input) 25%, var(--bg-hover) 50%, var(--bg-input) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* --- Toast Notifications --- */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 0.75rem 1.1rem;
    min-width: 260px;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.toast.success {
    border-left: 3px solid var(--accent-success);
}

.toast.error {
    border-left: 3px solid var(--accent-danger);
}

.toast.info {
    border-left: 3px solid var(--accent-info);
}

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

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

.empty-state .icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.empty-state h4 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.empty-state p {
    font-size: 0.85rem;
    max-width: 340px;
    margin: 0 auto;
}

/* --- Status Badge --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-success {
    background: var(--accent-success-bg);
    color: var(--accent-success);
}

.badge-warning {
    background: var(--accent-warning-bg);
    color: var(--accent-warning);
}

.badge-danger {
    background: var(--accent-danger-bg);
    color: var(--accent-danger);
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .scrape-form-row {
        grid-template-columns: 1fr 1fr;
    }

    .calculator-section {
        grid-template-columns: 1fr;
    }

    .settings-layout {
        grid-template-columns: 1fr;
    }

    .modal-two-col {
        grid-template-columns: 1fr;
    }

    .modal.modal-wide {
        max-width: 460px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 1rem;
    }

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

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .comparison-grid {
        grid-template-columns: 1fr;
    }
}