/* ============================================================================
   Phishing Report — App CSS
   Modern admin panel design
   ============================================================================ */

:root {
    --color-primary: #4f6ef7;
    --color-primary-hover: #3b5de7;
    --color-primary-light: rgba(79, 110, 247, 0.08);
    --color-danger: #ef4444;
    --color-danger-hover: #dc2626;
    --color-success: #22c55e;
    --color-warning: #f59e0b;
    --color-bg: #f0f2f5;
    --color-surface: #ffffff;
    --color-surface-alt: #f8f9fb;
    --color-text: #1a1d26;
    --color-text-secondary: #5a6278;
    --color-text-muted: #8b92a5;
    --color-border: #e3e6ec;
    --color-border-light: #eef0f4;
    --color-input-bg: #f8f9fb;
    --color-input-focus-bg: #ffffff;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 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.08);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.12);
    --transition: 150ms ease;
}

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

body.loading { visibility: hidden; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
}

.view { display: none; }
.view.active { display: block; }

/* ============================================================================
   Login
   ============================================================================ */

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #4f6ef7 100%);
}

.login-box {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 28px;
    color: var(--color-text);
    letter-spacing: -0.3px;
}

.form-desc { font-size: 13px; color: var(--color-text-secondary); margin-bottom: 16px; line-height: 1.5; }
.login-links { text-align: center; margin-top: 16px; }
.login-links a { font-size: 13px; color: var(--color-primary); text-decoration: none; font-weight: 500; }
.login-links a:hover { text-decoration: underline; }

/* ============================================================================
   Form elements
   ============================================================================ */

.form-group { margin-bottom: 14px; }

.form-group label,
.form-group-compact label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--color-text-secondary);
    letter-spacing: 0.01em;
}

.form-group input,
.form-group select,
.form-group textarea,
.form-group-compact input,
.form-group-compact select,
.form-group-compact textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-input-bg);
    transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.form-group-compact input:focus,
.form-group-compact select:focus,
.form-group-compact textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    background: var(--color-input-focus-bg);
    box-shadow: 0 0 0 3px rgba(79, 110, 247, 0.12);
}

.form-group textarea,
.form-group-compact textarea {
    resize: vertical;
    min-height: 36px;
}

.form-group select,
.form-group-compact select {
    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 12 12'%3E%3Cpath fill='%235a6278' d='M2.5 4.5L6 8l3.5-3.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

.form-group-compact { margin-bottom: 12px; }

/* ============================================================================
   Buttons
   ============================================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all var(--transition);
    white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--color-primary-hover); box-shadow: 0 2px 8px rgba(79, 110, 247, 0.3); }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--color-danger-hover); }
.btn-outline { background: var(--color-surface); color: var(--color-text-secondary); border: 1px solid var(--color-border); }
.btn-outline:hover { background: var(--color-surface-alt); border-color: var(--color-text-muted); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-full { width: 100%; margin-top: 8px; }

/* ============================================================================
   Messages
   ============================================================================ */

.msg { padding: 10px 14px; border-radius: 6px; font-size: 13px; margin-bottom: 14px; font-weight: 500; }
.msg-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.msg-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }

/* ============================================================================
   Header & Navigation
   ============================================================================ */

#app-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 0 28px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

#app-header .header-left { display: flex; align-items: center; gap: 28px; }
#app-header .header-left h1 { font-size: 15px; font-weight: 700; color: var(--color-text); letter-spacing: -0.3px; }
#app-header .header-right { display: flex; align-items: center; gap: 12px; }
#user-name { font-size: 13px; color: var(--color-text-muted); }

#app-nav { display: flex; gap: 2px; }

.nav-link {
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-secondary);
    text-decoration: none;
    border-radius: 6px;
    transition: all var(--transition);
}
.nav-link:hover { background: var(--color-surface-alt); color: var(--color-text); }
.nav-link.active { background: var(--color-primary); color: #fff; }

/* ============================================================================
   Layout
   ============================================================================ */

.container { max-width: 1360px; margin: 0 auto; padding: 24px 28px; }

.page { display: block; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-header h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; }
.page-header-actions { display: flex; align-items: center; gap: 8px; }

.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--color-text-muted); text-decoration: none; margin-bottom: 4px; font-weight: 500; }
.back-link:hover { color: var(--color-primary); }

.empty-text { color: var(--color-text-muted); text-align: center; padding: 60px 0; font-size: 14px; }

/* ============================================================================
   Data tables
   ============================================================================ */

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-surface);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--color-border);
}
.data-table th,
.data-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--color-border-light);
}
.data-table th {
    background: var(--color-surface-alt);
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
.data-table td { font-size: 13px; }
.data-table tbody tr { transition: background var(--transition); }
.data-table tbody tr:hover { background: var(--color-primary-light); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table .actions { white-space: nowrap; }
.data-table .actions a {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-primary);
    text-decoration: none;
    padding: 3px 0;
}
.data-table .actions a:hover { text-decoration: underline; }
.data-table .actions a.text-danger { color: var(--color-danger); }
.data-table .case-link { color: var(--color-primary); text-decoration: none; font-weight: 600; }
.data-table .case-link:hover { text-decoration: underline; }

/* ============================================================================
   Modals
   ============================================================================ */

.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 200;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    padding: 40px 20px;
}
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
}
.modal-box {
    position: relative;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 0;
    width: 100%;
    max-width: 480px;
    z-index: 1;
    margin: auto;
}
.modal-box h3 {
    font-size: 16px;
    font-weight: 700;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--color-border-light);
    letter-spacing: -0.2px;
}
.modal-box form,
.modal-box .modal-body {
    padding: 20px 24px 0;
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 24px;
    margin: 20px -24px 0;
    border-top: 1px solid var(--color-border-light);
    background: var(--color-surface-alt);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.modal-box-wide { max-width: 640px; }
.modal-box-xl { max-width: 920px; }

/* ============================================================================
   Badges
   ============================================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    white-space: nowrap;
    letter-spacing: 0.02em;
}
.badge-role { background: #eef2ff; color: #4338ca; }
.badge-success { background: #dcfce7; color: #15803d; }
.badge-muted { background: var(--color-surface-alt); color: var(--color-text-muted); border: 1px solid var(--color-border); }
.badge-open { background: #dbeafe; color: #1d4ed8; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 9px;
    background: var(--color-danger);
    color: #fff;
}

/* ============================================================================
   Tabs
   ============================================================================ */

.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--color-border);
}
.tab-btn {
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    color: var(--color-text-muted);
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.tab-btn:hover { color: var(--color-text); }
.tab-btn.active { color: var(--color-primary); border-bottom-color: var(--color-primary); font-weight: 600; }

/* ============================================================================
   Sections (case detail, etc.)
   ============================================================================ */

.section-block { margin-top: 24px; }
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-border);
}
.section-header h3 { font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--color-text-secondary); }

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    padding: 16px 20px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}
.info-item label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
}
.info-item span { font-size: 13px; color: var(--color-text); font-weight: 500; }

/* ============================================================================
   Form layout helpers
   ============================================================================ */

.form-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--color-border-light);
}
.form-section:last-of-type { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.form-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    margin-bottom: 14px;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

.form-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.form-col-full { grid-column: 1 / -1; }

/* ============================================================================
   Checkbox & permissions
   ============================================================================ */

.checkbox-list { max-height: 250px; overflow-y: auto; border: 1px solid var(--color-border); border-radius: 6px; padding: 6px; }
.checkbox-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; font-size: 13px; cursor: pointer; border-radius: 4px; }
.checkbox-item:hover { background: var(--color-surface-alt); }
.checkbox-item input[type="checkbox"] { width: 15px; height: 15px; margin: 0; flex-shrink: 0; accent-color: var(--color-primary); cursor: pointer; }

.perm-groups { max-height: 400px; overflow-y: auto; }
.perm-group { margin-bottom: 12px; }
.perm-group:last-child { margin-bottom: 0; }
.perm-group-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    padding: 4px 0;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--color-border-light);
}

/* ============================================================================
   Filter selects
   ============================================================================ */

.filter-select {
    padding: 6px 28px 6px 10px;
    font-size: 13px;
    font-family: inherit;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-surface);
    color: var(--color-text);
    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 12 12'%3E%3Cpath fill='%235a6278' d='M2.5 4.5L6 8l3.5-3.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}
.filter-select:focus { outline: none; border-color: var(--color-primary); }

/* ============================================================================
   Indicators
   ============================================================================ */

.indicator { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.indicator-alive { background: var(--color-success); box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2); }
.indicator-dead { background: var(--color-danger); box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2); }

/* ============================================================================
   Utilities
   ============================================================================ */

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

/* ============================================================================
   Responsive
   ============================================================================ */

@media (max-width: 480px) {
    .login-box { padding: 24px; }
    #app-header { padding: 0 12px; }
    .container { padding: 16px; }
    .form-columns { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
}
