/* ===== REUSABLE COMPONENTS ===== */

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}
.page-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
    user-select: none;
    outline: none;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}
.btn:active {
    transform: scale(0.97);
}
.btn-primary {
    background: var(--primary);
    color: var(--text-inverse);
}
.btn-primary:hover {
    background: var(--primary-light);
    box-shadow: 0 4px 12px rgba(26, 54, 93, 0.15);
    transform: translateY(-1px);
}
.btn-accent {
    background: var(--accent);
    color: var(--text-inverse);
}
.btn-accent:hover {
    background: var(--accent-light);
    box-shadow: 0 4px 12px rgba(230, 126, 34, 0.2);
    transform: translateY(-1px);
}
.btn-outline {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn-outline:hover {
    background: var(--bg-hover);
    border-color: var(--text-secondary);
    transform: translateY(-1px);
}
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    box-shadow: none;
}
.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.btn-danger {
    background: var(--error);
    color: var(--text-inverse);
}
.btn-danger:hover {
    background: hsl(5, 75%, 48%);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.2);
    transform: translateY(-1px);
}
.btn-success {
    background: var(--success);
    color: var(--text-inverse);
}
.btn-success:hover {
    background: hsl(145, 55%, 36%);
    box-shadow: 0 4px 12px rgba(46, 204, 113, 0.2);
    transform: translateY(-1px);
}
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-lg { padding: 12px 24px; font-size: 14px; border-radius: var(--radius-lg); }
.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* Cards with Premium Glassmorphism Details */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 22px;
    transition: all var(--transition-base);
}
.card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border);
    transform: translateY(-1px);
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-light);
}
.card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.1px;
}

/* Forms */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid hsl(217, 24%, 72%);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 13px;
    color: var(--text-primary);
    background: #ffffff;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-lighter);
    background: #ffffff;
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.form-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Stat Cards */
.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: var(--radius-lg);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
}
.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stat-icon.blue { background: var(--primary-lighter); color: var(--primary); }
.stat-icon.orange { background: var(--accent-lighter); color: var(--accent); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.red { background: var(--error-light); color: var(--error); }
.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}
.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
}
.badge-success { background: var(--success-light); color: var(--success); }
.badge-error { background: var(--error-light); color: var(--error); }
.badge-warning { background: var(--warning-light); color: #b7950b; }
.badge-info { background: var(--info-light); color: var(--info); }
.badge-neutral { background: var(--bg-hover); color: var(--text-secondary); }
.badge-primary { background: var(--primary-lighter); color: var(--primary); }

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table thead th {
    text-align: left;
    padding: 10px 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}
.data-table thead th:hover { color: var(--text-primary); }
.data-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
    vertical-align: middle;
}
.data-table tbody tr:hover { background: var(--bg-hover); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* Checkbox/Toggle indicators */
.indicator { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; font-size: 11px; font-weight: 700; }
.indicator-yes { background: var(--success-light); color: var(--success); }
.indicator-no { background: var(--bg-hover); color: var(--text-muted); }

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 1;
    transition: opacity var(--transition-base);
}
.modal-overlay.hidden { display: none; }
.modal-container {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    animation: modalIn 0.25s ease;
}
@keyframes modalIn {
    from { transform: scale(0.95) translateY(10px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border-light);
}
.modal-title { font-size: 17px; font-weight: 700; }
.modal-body { padding: 20px 24px; }
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 24px 20px;
    border-top: 1px solid var(--border-light);
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10001;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
}
.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--primary);
    font-size: 13px;
    font-weight: 500;
    animation: toastIn 0.3s ease;
    min-width: 280px;
    max-width: 420px;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--error); }
.toast.warning { border-left-color: var(--warning); }
@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}
.empty-state svg { margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p { font-size: 13px; margin-bottom: 20px; }

/* Tags/Chips */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: var(--bg-hover);
    border-radius: 16px;
    font-size: 12px;
    color: var(--text-secondary);
}
.tag-remove {
    cursor: pointer;
    opacity: 0.5;
    transition: opacity var(--transition-fast);
}
.tag-remove:hover { opacity: 1; }

/* Progress bar */
.progress-bar {
    height: 6px;
    background: var(--border-light);
    border-radius: 3px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width var(--transition-slow);
}
.progress-fill.blue { background: var(--primary); }
.progress-fill.green { background: var(--success); }
.progress-fill.orange { background: var(--accent); }

/* Tabs */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
}
.tab {
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition-fast);
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Checkbox */
.checkbox-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}
.checkbox-wrap input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

/* Glassmorphic Panel Utility */
.glass-panel {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

/* Micro-Animations & Glow Effects */
@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(230, 126, 34, 0.4);
    }
    50% {
        box-shadow: 0 0 12px 6px rgba(230, 126, 34, 0.2);
    }
}
.pulse-glow-accent {
    animation: pulse-glow 2s infinite ease-in-out;
}

@keyframes spinner-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-light);
    border-top: 2px solid var(--accent);
    border-radius: 50%;
    animation: spinner-spin 0.8s linear infinite;
    display: inline-block;
}
.spinner-lg {
    width: 36px;
    height: 36px;
    border-width: 3px;
    border-top-color: var(--accent);
}

/* Glassy Outlined input active focus border */
.form-input:focus-within, .form-select:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-lighter);
}

/* ===== REAL-TIME TERMINAL LOGGER ===== */
.terminal-container {
    background: #0d1117;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    overflow: hidden;
    font-family: 'Consolas', 'Courier New', Courier, monospace;
    box-shadow: var(--shadow-lg);
}
.terminal-header {
    background: #161b22;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: #c9d1d9;
    font-size: 12px;
    font-weight: 600;
}
.terminal-body {
    padding: 12px 16px;
    height: 180px;
    overflow-y: auto;
    color: #8b949e;
    font-size: 11.5px;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.terminal-line {
    white-space: pre-wrap;
    word-break: break-all;
    text-align: left;
}
.terminal-timestamp {
    color: #58a6ff;
    margin-right: 8px;
    font-weight: 500;
}
.log-tag {
    font-weight: 700;
    padding: 1px 4px;
    border-radius: var(--radius-sm);
    margin-right: 4px;
    font-size: 10.5px;
}
.browser-tag { background: rgba(56, 189, 248, 0.15); color: #38bdf8; }
.contact-tag { background: rgba(74, 222, 128, 0.15); color: #4ade80; }
.ai-tag { background: rgba(251, 146, 60, 0.15); color: #fb923c; }
.analyzer-tag { background: rgba(167, 139, 250, 0.15); color: #a78bfa; }

.browser-line { color: #e6edf3; }
.contact-line { color: #f0f6fc; }
.ai-tag-line { color: #f0f6fc; }
.analyzer-line { color: #e6edf3; }
.system-line { color: #8b949e; font-style: italic; }

.terminal-body::-webkit-scrollbar {
    width: 6px;
}
.terminal-body::-webkit-scrollbar-track {
    background: #0d1117;
}
.terminal-body::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 3px;
}
.terminal-body::-webkit-scrollbar-thumb:hover {
    background: #8b949e;
}

/* ===== SCREENSHOT SECURE MODAL ===== */
.screenshot-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(13, 17, 23, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10005;
    opacity: 1;
    transition: opacity 0.3s ease;
    animation: fadeIn 0.3s ease forwards;
}
.screenshot-modal-overlay.fade-out {
    opacity: 0;
}
.screenshot-modal-content {
    width: 90%;
    max-width: 960px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-2xl);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: zoomIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.screenshot-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    font-weight: 700;
    font-size: 15px;
    color: var(--text-primary);
}
.modal-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    transition: color var(--transition-fast);
    padding: 0 4px;
}
.modal-close-btn:hover {
    color: var(--text-primary);
}
.screenshot-modal-body {
    padding: 0;
    max-height: 70vh;
    overflow-y: auto;
    background: #1e1e1e;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}
.screenshot-img {
    max-width: 100%;
    height: auto;
    display: block;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}
.screenshot-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-hover);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes zoomIn {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* PuTTY Style Modal Override */
.modal-container.putty-modal {
    max-width: 70vw !important;
    width: 70vw !important;
    height: 70vh !important;
    max-height: 70vh !important;
    background: #000000 !important;
    border-radius: 4px !important;
    border: 1px solid #555555 !important;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    overflow: hidden !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8) !important;
}

.modal-container.putty-modal .modal-header {
    background: #2b2b2b !important;
    color: #dfdfdf !important;
    padding: 6px 12px !important;
    border-bottom: 1px solid #444444 !important;
    height: 34px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    border-radius: 0 !important;
    box-sizing: border-box !important;
}

.modal-container.putty-modal .modal-title {
    font-family: 'Consolas', 'Courier New', Courier, monospace !important;
    font-size: 13px !important;
    font-weight: normal !important;
    letter-spacing: 0.5px;
}

.modal-container.putty-modal .modal-header .btn-icon {
    background: transparent !important;
    border: none !important;
    color: #aaaaaa !important;
    cursor: pointer !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 28px !important;
    height: 34px !important;
    margin-right: -12px !important; /* aligns to the right edge */
    border-radius: 0 !important;
    transition: background-color 0.1s !important;
}

.modal-container.putty-modal .modal-header .btn-icon:hover {
    background: #e81123 !important;
    color: #ffffff !important;
}

.modal-container.putty-modal .modal-body {
    padding: 0 !important;
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    background: #000000 !important;
    overflow: hidden !important;
}

.modal-container.putty-modal .modal-footer {
    display: none !important;
}

.modal-container.putty-modal .terminal-body::-webkit-scrollbar {
    width: 8px !important;
}
.modal-container.putty-modal .terminal-body::-webkit-scrollbar-track {
    background: #000000 !important;
}
.modal-container.putty-modal .terminal-body::-webkit-scrollbar-thumb {
    background: #555555 !important;
    border-radius: 4px !important;
}
.modal-container.putty-modal .terminal-body::-webkit-scrollbar-thumb:hover {
    background: #777777 !important;
}
