/* Peptide Tracker Styles */
:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --border: #334155;
    --border-light: rgba(148, 163, 184, 0.15);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* Layout */
.container { max-width: 1200px; margin: 0 auto; padding: 20px; }
.container-narrow { max-width: 500px; margin: 0 auto; padding: 20px; }

/* Header */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent);
}

.header-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Navigation */
.nav {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}

.nav-link {
    padding: 10px 16px;
    border-radius: 8px;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.2s;
}

.nav-link:hover, .nav-link.active {
    background: var(--accent);
    color: white;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* Alerts */
.alert-list { list-style: none; }

.alert-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    margin-bottom: 8px;
}

.alert-item.critical {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--danger);
}

.alert-item.warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
}

.alert-name { font-weight: 600; }
.alert-product { color: var(--text-secondary); font-size: 0.9rem; margin-left: 8px; }
.alert-days {
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
}
.alert-days.critical { background: var(--danger); color: white; }
.alert-days.warning { background: var(--warning); color: #000; }

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th, .table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
}

.table tr:hover td {
    background: rgba(59, 130, 246, 0.05);
}

/* Forms */
.form-group { margin-bottom: 16px; }

.form-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.form-textarea { resize: vertical; min-height: 100px; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: white;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3); }

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); color: var(--text-primary); }

.btn-success { background: var(--success); color: white; }
.btn-warning { background: var(--warning); color: #000; }
.btn-danger { background: var(--danger); color: white; }

.btn-sm { padding: 8px 14px; font-size: 0.85rem; }
.btn-block { width: 100%; }

/* Customer List */
.customer-list { list-style: none; }

.customer-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    margin-bottom: 10px;
    transition: all 0.2s;
}

.customer-item:hover {
    border-color: var(--accent);
}

.customer-info h3 { font-size: 1rem; margin-bottom: 2px; }
.customer-info p { font-size: 0.85rem; color: var(--text-secondary); }

.customer-stats {
    display: flex;
    gap: 20px;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-active { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.badge-pending { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.badge-paused { background: rgba(148, 163, 184, 0.2); color: var(--text-secondary); }

/* Protocol Cards */
.protocol-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
}

.protocol-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.protocol-name { font-weight: 600; font-size: 1.1rem; }
.protocol-dose { color: var(--accent); margin-top: 4px; }
.protocol-schedule { color: var(--text-secondary); font-size: 0.9rem; margin-top: 4px; }

/* Supply Indicator */
.supply-bar {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.supply-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s;
}

.supply-fill.good { background: var(--success); }
.supply-fill.warning { background: var(--warning); }
.supply-fill.danger { background: var(--danger); }

/* Today View */
.today-header {
    text-align: center;
    padding: 24px 0;
}

.today-date {
    font-size: 1.8rem;
    font-weight: 700;
}

.today-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 4px;
}

.dose-card {
    display: flex;
    flex-direction: column;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    margin-bottom: 10px;
}

.dose-card.done { opacity: 0.5; }

.dose-info { width: 100%; margin-bottom: 8px; }
.dose-name { font-weight: 600; }
.dose-amount { color: var(--accent); font-size: 0.9rem; }
.dose-detail { font-size: 0.9rem; margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.dose-note { font-size: 0.8rem; color: var(--warning); margin-top: 4px; font-style: italic; }

/* Syringe Visual */
.syringe-container { width: 100%; margin-bottom: 10px; text-align: center; }
.syringe-svg { width: 100%; max-width: 320px; height: auto; }
.syringe-label { font-size: 0.8rem; font-weight: 600; color: var(--success); margin-top: 2px; }

/* Titration Guidance */
.titration-guidance {
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 8px;
    padding: 10px 14px;
    margin: 8px 0;
    font-size: 0.85rem;
}

/* Peptide info link */
.info-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-left: 8px;
    font-size: 14px;
    color: var(--primary);
    text-decoration: none;
    opacity: 0.6;
    transition: opacity 0.2s;
    vertical-align: middle;
}
.info-link:hover {
    opacity: 1;
}
.protocol-name .info-link {
    font-size: 12px;
}

.dose-actions { display: flex; gap: 8px; width: 100%; margin-top: 8px; }

.dose-btn {
    flex: 1;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.dose-btn:hover { border-color: var(--accent); color: var(--accent); }
.dose-btn.taken { background: var(--success); color: white; border-color: var(--success); }
.dose-btn.skipped { background: var(--warning); color: #000; border-color: var(--warning); }

/* Messages */
.message {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.message-success { background: rgba(16, 185, 129, 0.1); border: 1px solid var(--success); color: var(--success); }
.message-error { background: rgba(239, 68, 68, 0.1); border: 1px solid var(--danger); color: var(--danger); }

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.5; }

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
}

.login-title {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.login-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 32px;
}

/* Responsive */
@media (max-width: 768px) {
    .header { flex-direction: column; gap: 12px; }
    .stats-grid { grid-template-columns: 1fr; }
    .customer-item { flex-direction: column; align-items: flex-start; gap: 12px; }
    .table { display: block; overflow-x: auto; }
}

/* Install Button */
.install-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--accent);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    z-index: 1000;
    transition: all 0.2s ease;
}

.install-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}
