/* ===== DESIGN SYSTEM - RegenInsite ===== */

/* --- Variables --- */
:root {
    --primary: #667eea;
    --primary-dark: #5a6fd6;
    --secondary: #764ba2;
    --dark: #1a1a2e;
    --gray: #6b7280;
    --light: #f8fafc;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --border: #e5e7eb;
    --text: #333;
    --text-light: #666;
    --text-muted: #999;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.15);
    --shadow-focus: 0 0 0 3px rgba(102, 126, 234, 0.1);
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-family); line-height: 1.6; color: var(--text); background: var(--light); }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* --- Skip Link (Accessibility) --- */
.skip-link {
    position: absolute; top: -40px; left: 0; padding: 8px 16px;
    background: var(--primary); color: white; z-index: 10000;
    transition: top 0.2s;
}
.skip-link:focus { top: 0; }

/* --- Buttons --- */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 18px; border: 1px solid var(--border); border-radius: var(--radius-md);
    font-size: 14px; font-weight: 500; cursor: pointer;
    background: white; color: var(--text); transition: all 0.2s;
    text-decoration: none; line-height: 1.4;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--primary); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: white; }
.btn-secondary { background: var(--border); color: var(--gray); border-color: var(--border); }
.btn-secondary:hover { background: #d1d5db; }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover { background: #dc2626; }
.btn-outline { background: white; border: 1px solid var(--border); color: var(--gray); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-icon { padding: 8px; display: flex; align-items: center; justify-content: center; }

/* --- Cards --- */
.card {
    background: white; border-radius: var(--radius-lg); padding: 25px;
    box-shadow: var(--shadow-md); margin-bottom: 20px;
}
.stat-card {
    background: white; padding: 20px; border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.stat-card.primary { background: var(--gradient-primary); color: white; }

/* --- Forms --- */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block; font-size: 13px; font-weight: 600;
    color: var(--text); margin-bottom: 6px;
}
.form-group label .required { color: var(--danger); margin-left: 2px; }
.form-input, .form-select, .form-textarea {
    width: 100%; padding: 10px 14px; border: 1px solid var(--border);
    border-radius: var(--radius-md); font-size: 14px; font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none; border-color: var(--primary); box-shadow: var(--shadow-focus);
}
.form-input.error { border-color: var(--danger); }
.form-help { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; display: none; }

/* --- Alerts --- */
.alert {
    padding: 12px 16px; border-radius: var(--radius-md);
    font-size: 14px; margin-bottom: 16px;
}
.alert-success { background: #d1fae5; color: #065f46; }
.alert-warning { background: #fef3c7; color: #92400e; }
.alert-danger { background: #fee2e2; color: #991b1b; }
.alert-info { background: #dbeafe; color: #1e40af; }

/* --- Modals --- */
.modal-overlay {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 1000;
    align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
    background: white; border-radius: var(--radius-lg); width: 90vw; max-width: 500px;
    max-height: 85vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close {
    background: none; border: none; font-size: 20px; cursor: pointer;
    color: var(--text-muted); padding: 4px;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px 24px; }
.modal-footer {
    display: flex; justify-content: flex-end; gap: 8px;
    padding: 16px 24px; border-top: 1px solid var(--border);
}

/* --- Animations --- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes skeleton-pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }
.spinner {
    width: 20px; height: 20px; border: 2px solid var(--border);
    border-top-color: var(--primary); border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
.skeleton { animation: skeleton-pulse 1.5s ease-in-out infinite; background: #e5e7eb; border-radius: 4px; }

/* --- Tables --- */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    text-align: left; padding: 10px 12px; font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
.data-table td { padding: 10px 12px; font-size: 14px; border-bottom: 1px solid #f3f4f6; }
.data-table tr:hover { background: #f9fafb; }
.empty-row { text-align: center; color: var(--text-muted); padding: 30px 12px; }

/* --- Badges --- */
.badge {
    display: inline-flex; align-items: center; padding: 2px 8px;
    border-radius: 12px; font-size: 11px; font-weight: 600;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }

/* --- Utility --- */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

/* --- Responsive (largest-to-smallest so narrower breakpoints override) --- */
@media (max-width: 1024px) {
    .hide-desktop-only { display: none !important; }
}
@media (max-width: 768px) {
    .hide-tablet { display: none !important; }
    .stack-mobile { flex-direction: column; }
    .data-table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
@media (max-width: 480px) {
    .btn-lg { padding: 12px 20px; font-size: 15px; }
    .modal { width: 95vw; max-width: none; margin: 10px; }
    .card { padding: 16px; }
    .hide-mobile { display: none !important; }
}
