/* ============================================================
   SIM-KARINA — Shared Component Styles
   Design System: Premium Dark/Light, Glassmorphism, Inter Font
   ============================================================ */

/* Font: system stack (body font-family fallback) — no external CDN per CSP self-host policy */

/* ── CSS Variables (Design Tokens) ───────────────────────── */
:root {
    --primary:        #4f46e5;
    --primary-dark:   #4338ca;
    --primary-light:  #818cf8;
    --primary-glow:   rgba(79, 70, 229, 0.25);

    --success:        #10b981;
    --success-bg:     rgba(16, 185, 129, 0.1);
    --warning:        #f59e0b;
    --warning-bg:     rgba(245, 158, 11, 0.1);
    --danger:         #ef4444;
    --danger-bg:      rgba(239, 68, 68, 0.1);
    --info:           #3b82f6;
    --info-bg:        rgba(59, 130, 246, 0.1);

    --dark-900:       #0f172a;
    --dark-800:       #1e293b;
    --dark-700:       #334155;
    --dark-600:       #475569;
    --dark-500:       #64748b;

    --light-100:      #f8fafc;
    --light-200:      #f1f5f9;
    --light-300:      #e2e8f0;
    --light-400:      #cbd5e1;

    --text-primary:   #0f172a;
    --text-secondary: #64748b;
    --text-muted:     #94a3b8;

    --border:         #e2e8f0;
    --shadow-sm:      0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md:      0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg:      0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl:      0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);

    --radius-sm:      6px;
    --radius-md:      10px;
    --radius-lg:      16px;
    --radius-xl:      24px;
    --radius-full:    9999px;

    --transition:     all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--light-100);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}
a:hover {
    color: var(--primary-dark);
}

img { max-width: 100%; }

/* ── Typography ──────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-primary);
}
h1 { font-size: 1.875rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary-color { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-center { text-align: center; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
    background: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: var(--transition);
}
.card:hover {
    box-shadow: var(--shadow-lg);
}
.card-body {
    padding: 1.5rem;
}
.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--light-100);
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ── Metric Cards ────────────────────────────────────────── */
.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.metric-card {
    background: #ffffff;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}
.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}
.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.metric-card.primary::before   { background: linear-gradient(90deg, var(--primary), var(--primary-light)); }
.metric-card.success::before   { background: linear-gradient(90deg, var(--success), #34d399); }
.metric-card.warning::before   { background: linear-gradient(90deg, var(--warning), #fbbf24); }
.metric-card.danger::before    { background: linear-gradient(90deg, var(--danger), #f87171); }

.metric-card .metric-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}
.metric-card.primary .metric-icon   { background: rgba(79, 70, 229, 0.1); color: var(--primary); }
.metric-card.success .metric-icon   { background: var(--success-bg); color: var(--success); }
.metric-card.warning .metric-icon   { background: var(--warning-bg); color: var(--warning); }

.metric-card .metric-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.2;
    color: var(--text-primary);
}
.metric-card .metric-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    font-weight: 500;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius-md);
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1.5;
    white-space: nowrap;
}
.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 2px 8px var(--primary-glow);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), #3730a3);
    box-shadow: 0 4px 16px var(--primary-glow);
    color: #fff;
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: #fff;
}
.btn-success:hover {
    background: linear-gradient(135deg, #059669, #047857);
    color: #fff;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    color: #fff;
}
.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: #fff;
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning), #d97706);
    color: #fff;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text-primary);
}
.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(79, 70, 229, 0.05);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}
.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}
.btn-block {
    display: flex;
    width: 100%;
}
.btn-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* ── Form Controls ───────────────────────────────────────── */
.form-group {
    margin-bottom: 1.25rem;
}
.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}
.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    color: var(--text-primary);
    background: #fff;
    transition: var(--transition);
    outline: none;
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}
.form-control:read-only {
    background: var(--light-200);
    color: var(--text-secondary);
    cursor: not-allowed;
}
.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-inline {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}
.form-inline .form-group {
    margin-bottom: 0;
    flex: 1;
    min-width: 180px;
}

/* ── Tables ──────────────────────────────────────────────── */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.table thead {
    background: var(--dark-800);
    color: #fff;
}
.table thead th {
    padding: 0.875rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}
.table tbody td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table tbody tr {
    transition: var(--transition);
}
.table tbody tr:hover {
    background: var(--light-200);
}
.table tbody tr:last-child td {
    border-bottom: none;
}

/* ── Badges / Status Pills ───────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.03em;
}
.badge-success {
    background: var(--success-bg);
    color: var(--success);
}
.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
}
.badge-danger {
    background: var(--danger-bg);
    color: var(--danger);
}
.badge-info {
    background: var(--info-bg);
    color: var(--info);
}
.badge-primary {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
}

/* ── Alerts / Flash Messages ─────────────────────────────── */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideDown 0.3s ease-out;
}
.alert-success {
    background: var(--success-bg);
    color: #065f46;
    border: 1px solid rgba(16, 185, 129, 0.2);
}
.alert-danger {
    background: var(--danger-bg);
    color: #991b1b;
    border: 1px solid rgba(239, 68, 68, 0.2);
}
.alert-warning {
    background: var(--warning-bg);
    color: #92400e;
    border: 1px solid rgba(245, 158, 11, 0.2);
}
.alert-info {
    background: var(--info-bg);
    color: #1e40af;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Pagination ──────────────────────────────────────────── */
.pagination {
    display: flex;
    gap: 0.375rem;
    justify-content: center;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}
.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 0.5rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition);
    border: 1px solid var(--border);
    color: var(--text-primary);
}
.pagination a:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.pagination .active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ── Empty State ─────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}
.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}
.empty-state h3 {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}
.empty-state p {
    font-size: 0.9rem;
    max-width: 400px;
    margin: 0 auto;
}

/* ── Utility Classes ─────────────────────────────────────── */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mr-1 { margin-right: 0.5rem; }
.ml-1 { margin-left: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }

/* ── Page Header ─────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.page-header h1 {
    font-size: 1.5rem;
    font-weight: 800;
}
.page-header .page-subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* ── Search Bar ──────────────────────────────────────────── */
.search-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.search-bar .form-control {
    flex: 1;
    min-width: 250px;
}

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--light-200);
}
::-webkit-scrollbar-thumb {
    background: var(--light-400);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--dark-500);
}

/* ── Delete Confirmation Modal (Premium) ─────────────────── */
.delete-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(6, 10, 18, 0.52);
    backdrop-filter: blur(10px) saturate(1.1);
    -webkit-backdrop-filter: blur(10px) saturate(1.1);
    animation: dmFadeIn 0.22s ease;
}
.delete-modal-overlay.is-open {
    display: flex;
}
@keyframes dmFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes dmSlideUp {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.delete-modal {
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18), 0 8px 20px rgba(15, 23, 42, 0.08), 0 0 0 1px rgba(255,255,255,0.7) inset;
    padding: 1.5rem 1.5rem 1.25rem;
    animation: dmSlideUp 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
    position: relative;
    overflow: hidden;
}
.delete-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #ef4444, #f87171);
}
.delete-modal-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: rgba(239, 68, 68, 0.10);
    border: 1px solid rgba(239, 68, 68, 0.14);
    color: #ef4444;
    margin-bottom: 1rem;
}
.delete-modal-title {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    line-height: 1.25;
}
.delete-modal-desc {
    margin-top: 0.4rem;
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.6;
}
.delete-modal-detail {
    margin-top: 0.9rem;
    background: linear-gradient(180deg, #fbfdff, #f8fafc);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.75rem 0.9rem;
    font-size: 0.84rem;
    display: none;
}
.delete-modal-detail.is-show {
    display: block;
}
.delete-modal-detail strong {
    color: var(--text-primary);
    font-weight: 700;
}
.delete-modal-detail .dm-row {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.3rem 0;
    border-bottom: 1px dashed rgba(226,232,240,0.9);
}
.delete-modal-detail .dm-row:last-child {
    border-bottom: none;
}
.delete-modal-detail .dm-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}
.delete-modal-detail .dm-value {
    font-weight: 600;
    color: var(--text-primary);
    font-family: ui-monospace, monospace;
    max-width: 60%;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.delete-modal-actions {
    display: flex;
    gap: 0.6rem;
    margin-top: 1.25rem;
}
.delete-modal-actions .btn {
    flex: 1;
    min-height: 44px;
    border-radius: 12px;
    font-weight: 700;
}
.delete-modal-actions .btn-danger {
    box-shadow: 0 8px 18px rgba(239,68,68,0.22);
}
.delete-modal-warning {
    margin-top: 0.9rem;
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.16);
    border-radius: 10px;
    padding: 0.6rem 0.75rem;
    font-size: 0.78rem;
    color: #92400e;
    line-height: 1.5;
    font-weight: 500;
}
.delete-modal-warning svg {
    flex-shrink: 0;
    margin-top: 1px;
}
@media (max-width: 640px) {
    .delete-modal {
        max-width: 100%;
        margin: 0 0.25rem;
        border-radius: 18px;
        padding: 1.25rem 1.15rem 1.1rem;
    }
}
