/* =============================================================================
   COMPONENTS CSS - Tables, Modals, Charts, Toasts
   ============================================================================= */

/* =============================================================================
   DATA TABLES
   ============================================================================= */

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.data-table thead {
    background: rgba(0, 0, 0, 0.3);
}

.data-table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
}

.data-table th.sortable:hover {
    color: var(--primary);
}

.data-table th.sortable::after {
    content: '↕';
    margin-left: 6px;
    opacity: 0.4;
}

.data-table th.sorted-asc::after {
    content: '↑';
    opacity: 1;
    color: var(--primary);
}

.data-table th.sorted-desc::after {
    content: '↓';
    opacity: 1;
    color: var(--primary);
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background-color 0.15s;
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table .cell-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.data-table .cell-actions .btn {
    padding: 6px 10px;
    font-size: 0.8rem;
}

/* Table Responsive */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius);
}

/* Table Loading State */
.table-loading {
    position: relative;
    min-height: 200px;
}

.table-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 15, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Empty State */
.table-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.table-empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.table-empty-text {
    font-size: 1rem;
    margin-bottom: 16px;
}

/* =============================================================================
   PAGINATION
   ============================================================================= */

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-top: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.2);
}

.pagination-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination-btn {
    padding: 8px 12px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--primary);
    border-color: var(--primary);
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-pages {
    display: flex;
    gap: 4px;
}

.pagination-page {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.pagination-page:hover {
    border-color: var(--primary);
}

.pagination-page.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* =============================================================================
   MODALS
   ============================================================================= */

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: linear-gradient(180deg, #1A2540 0%, #162038 100%);
    border-radius: 16px;
    border: 1px solid rgba(59, 130, 246, 0.2);
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        0 0 60px rgba(59, 130, 246, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateY(-30px) scale(0.9);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-backdrop.active .modal {
    transform: translateY(0) scale(1);
}

.modal-lg {
    max-width: 640px;
}

.modal-xl {
    max-width: 860px;
}

/* Modal responsive for tablets */
@media (max-width: 992px) {
    .modal-lg {
        max-width: 90vw;
    }
    .modal-xl {
        max-width: 95vw;
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px 20px;
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.08) 0%, transparent 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.modal-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.02em;
}

.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    border-radius: 10px;
    font-size: 1.3rem;
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
    transform: rotate(90deg);
}

.modal-body {
    padding: 28px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 28px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.3);
}

.modal-footer .btn {
    min-width: 120px;
    padding: 12px 24px;
    font-weight: 600;
}

.modal-footer .btn-ghost {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.7);
}

.modal-footer .btn-ghost:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.modal-footer .btn-primary {
    background: linear-gradient(135deg, #3B82F6 0%, #8B5CF6 100%);
    border: none;
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.modal-footer .btn-primary:hover {
    background: linear-gradient(135deg, #60A5FA 0%, #A78BFA 100%);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
    transform: translateY(-1px);
}

/* Confirmation Modal */
.confirm-modal .modal-body {
    text-align: center;
    padding: 40px 32px;
}

.confirm-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    display: block;
}

.confirm-icon.warning {
    color: #f59e0b;
    text-shadow: 0 0 30px rgba(245, 158, 11, 0.4);
}

.confirm-icon.danger {
    color: #ef4444;
    text-shadow: 0 0 30px rgba(239, 68, 68, 0.4);
}

.confirm-icon.success {
    color: #22D3EE;
    text-shadow: 0 0 30px rgba(34, 211, 238, 0.4);
}

.confirm-message {
    font-size: 1.15rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 10px;
}

.confirm-submessage {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.5;
}

/* =============================================================================
   TOASTS
   ============================================================================= */

#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column-reverse;
    gap: 14px;
    max-width: 380px;
}

.toast {
    background: linear-gradient(135deg, #1a2332 0%, #0f1419 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 18px 22px;
    box-shadow:
        0 15px 35px -10px rgba(0, 0, 0, 0.5),
        0 0 40px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: flex-start;
    gap: 14px;
    animation: toastSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(100%) scale(0.8);
        opacity: 0;
    }
    to {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

.toast.removing {
    animation: toastSlideOut 0.3s ease forwards;
}

@keyframes toastSlideOut {
    to {
        transform: translateX(100%) scale(0.8);
        opacity: 0;
    }
}

.toast-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
}

.toast-content {
    flex: 1;
    padding-top: 2px;
}

.toast-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #fff;
    margin-bottom: 4px;
    letter-spacing: -0.01em;
}

.toast-message {
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.4;
}

.toast-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    padding: 6px;
    font-size: 1.1rem;
    line-height: 1;
    transition: all 0.2s;
    border-radius: 8px;
}

.toast-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    border-radius: 0 3px 0 0;
    animation: progressShrink linear forwards;
}

@keyframes progressShrink {
    from { width: 100%; }
    to { width: 0%; }
}

/* Toast Variants */
.toast.success {
    border-left: 4px solid #22D3EE;
    box-shadow:
        0 15px 35px -10px rgba(0, 0, 0, 0.5),
        0 0 40px rgba(34, 211, 238, 0.15);
}

.toast.success .toast-icon {
    color: #22D3EE;
    background: rgba(34, 211, 238, 0.15);
}

.toast.success .toast-progress {
    background: linear-gradient(90deg, #22D3EE, #3B82F6);
}

.toast.error {
    border-left: 4px solid #ef4444;
    box-shadow:
        0 15px 35px -10px rgba(0, 0, 0, 0.5),
        0 0 40px rgba(239, 68, 68, 0.15);
}

.toast.error .toast-icon {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
}

.toast.error .toast-progress {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

.toast.warning {
    border-left: 4px solid #f59e0b;
    box-shadow:
        0 15px 35px -10px rgba(0, 0, 0, 0.5),
        0 0 40px rgba(245, 158, 11, 0.15);
}

.toast.warning .toast-icon {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.15);
}

.toast.warning .toast-progress {
    background: linear-gradient(90deg, #f59e0b, #d97706);
}

.toast.info {
    border-left: 4px solid #4facfe;
    box-shadow:
        0 15px 35px -10px rgba(0, 0, 0, 0.5),
        0 0 40px rgba(79, 172, 254, 0.15);
}

.toast.info .toast-icon {
    color: #4facfe;
    background: rgba(79, 172, 254, 0.15);
}

.toast.info .toast-progress {
    background: linear-gradient(90deg, #4facfe, #00f2fe);
}

/* =============================================================================
   CHARTS
   ============================================================================= */

.chart-container {
    position: relative;
    width: 100%;
    height: 300px;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 16px;
    justify-content: center;
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.chart-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

/* Mini Charts for Cards */
.mini-chart {
    height: 60px;
    margin-top: 16px;
}

/* Stat Cards with Sparklines */
.stat-trend {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 0.85rem;
}

.stat-trend.up {
    color: var(--success);
}

.stat-trend.down {
    color: var(--danger);
}

.stat-trend-icon {
    font-size: 0.8rem;
}

/* =============================================================================
   DROPDOWNS
   ============================================================================= */

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
}

.dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text);
    text-decoration: none;
    transition: background-color 0.15s;
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    font-size: 0.9rem;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.dropdown-item.danger {
    color: var(--danger);
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 0;
}

/* =============================================================================
   TABS
   ============================================================================= */

.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}

.tab {
    padding: 12px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 0.2s;
    cursor: pointer;
    background: transparent;
    border-top: none;
    border-left: none;
    border-right: none;
    font-size: 0.95rem;
}

.tab:hover {
    color: var(--text);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* =============================================================================
   TIMELINE / ACTIVITY
   ============================================================================= */

.timeline {
    position: relative;
    padding-left: 24px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding-bottom: 24px;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -20px;
    top: 0;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 3px solid var(--primary);
}

.timeline-dot.success {
    border-color: var(--success);
}

.timeline-dot.warning {
    border-color: var(--warning);
}

.timeline-dot.danger {
    border-color: var(--danger);
}

.timeline-content {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius);
    padding: 12px 16px;
}

.timeline-title {
    font-weight: 500;
    color: var(--text);
    margin-bottom: 4px;
}

.timeline-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.timeline-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* =============================================================================
   PROGRESS BARS
   ============================================================================= */

.progress {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-bar.success {
    background: var(--success);
}

.progress-bar.warning {
    background: var(--warning);
}

.progress-bar.danger {
    background: var(--danger);
}

/* Progress with label */
.progress-wrapper {
    margin-bottom: 16px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.progress-label {
    color: var(--text);
}

.progress-value {
    color: var(--text-secondary);
}

/* =============================================================================
   AVATARS
   ============================================================================= */

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
    text-transform: uppercase;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 0.85rem;
}

.avatar-lg {
    width: 56px;
    height: 56px;
    font-size: 1.3rem;
}

.avatar-group {
    display: flex;
}

.avatar-group .avatar {
    margin-left: -10px;
    border: 2px solid var(--bg);
}

.avatar-group .avatar:first-child {
    margin-left: 0;
}

/* =============================================================================
   TOOLTIPS
   ============================================================================= */

[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    font-size: 0.8rem;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    margin-bottom: 8px;
    z-index: 100;
}

[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}

/* =============================================================================
   SKELETON LOADING
   ============================================================================= */

.skeleton {
    background: linear-gradient(90deg,
        rgba(255, 255, 255, 0.05) 0%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0.05) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-text:last-child {
    width: 60%;
}

.skeleton-title {
    height: 24px;
    width: 40%;
    margin-bottom: 16px;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.skeleton-btn {
    height: 40px;
    width: 100px;
}

/* =============================================================================
   KANBAN / PIPELINE VIEW
   ============================================================================= */

.kanban-board {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding: 16px 0;
}

.kanban-column {
    flex: 0 0 280px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 250px);
}

.kanban-column-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.kanban-column-title {
    font-weight: 600;
    color: var(--text);
}

.kanban-column-count {
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.kanban-column-body {
    padding: 12px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.kanban-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    cursor: grab;
    transition: all 0.2s;
}

.kanban-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.kanban-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.kanban-card-title {
    font-weight: 500;
    color: var(--text);
    margin-bottom: 8px;
}

.kanban-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* =============================================================================
   QUICK ADD MENU
   ============================================================================= */

.quick-add-menu {
    position: fixed;
    top: 70px;
    right: 20px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
}

.quick-add-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.quick-add-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text);
    text-decoration: none;
    transition: background-color 0.15s;
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
}

.quick-add-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.quick-add-icon {
    font-size: 1.2rem;
}

/* =============================================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================================= */

@media (max-width: 768px) {
    .pagination {
        flex-direction: column;
        gap: 16px;
    }

    /* MODAL MOBILE FIX - Ensure solid background */
    .modal-backdrop {
        background: rgba(0, 0, 0, 0.95) !important;
        backdrop-filter: blur(10px) !important;
        padding: 10px !important;
    }

    .modal {
        max-height: 95vh;
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 16px !important;
        background: #1E293B !important;
        border: 1px solid rgba(59, 130, 246, 0.3) !important;
    }

    .modal-header {
        padding: 16px 20px !important;
        background: #1E293B !important;
    }

    .modal-title {
        font-size: 1.1rem !important;
    }

    .modal-body {
        padding: 16px 20px !important;
        background: #162038 !important;
    }

    .modal-footer {
        padding: 16px 20px !important;
        flex-direction: column !important;
        gap: 10px !important;
        background: #1E293B !important;
    }

    .modal-footer .btn {
        width: 100% !important;
        min-width: unset !important;
    }

    #toast-container {
        left: 20px;
        right: 20px;
        max-width: none;
    }

    .kanban-board {
        padding: 16px;
    }

    .kanban-column {
        flex: 0 0 260px;
    }

    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab {
        white-space: nowrap;
        padding: 10px 16px;
    }

    /* Table Mobile Improvements */
    .table-container {
        margin: 0 -16px;
        padding: 0 16px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table {
        min-width: auto;
    }

    .data-table th,
    .data-table td {
        padding: 10px 12px;
        font-size: 0.85rem;
        white-space: normal;
    }

    .data-table .cell-actions {
        gap: 6px;
    }

    .data-table .cell-actions .btn {
        padding: 8px 12px;
        font-size: 0.8rem;
        min-height: 36px;
    }

    /* Form Fields Mobile */
    .form-row {
        flex-direction: column !important;
        gap: 16px !important;
    }

    .form-group {
        width: 100% !important;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px !important; /* Prevents iOS zoom */
        padding: 12px !important;
    }

    /* Timeline Mobile */
    .timeline {
        padding-left: 20px;
    }

    .timeline-content {
        padding: 10px 12px;
    }

    /* Kanban Mobile */
    .kanban-column {
        flex: 0 0 85vw;
        max-width: 85vw;
    }

    /* Avatar Mobile */
    .avatar-lg {
        width: 48px;
        height: 48px;
        font-size: 1.1rem;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .modal {
        border-radius: 12px !important;
    }

    .modal-header {
        padding: 14px 16px !important;
    }

    .modal-body {
        padding: 14px 16px !important;
    }

    .modal-footer {
        padding: 14px 16px !important;
    }

    .data-table th,
    .data-table td {
        padding: 8px 10px;
        font-size: 0.8rem;
    }

    .pagination-controls {
        flex-wrap: wrap;
        justify-content: center;
    }

    .pagination-page {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }
}

/* =============================================================================
   SECURITY DASHBOARD
   ============================================================================= */

.security-dashboard {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Security Banner */
.security-banner {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15) 0%, rgba(34, 197, 94, 0.05) 100%);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.security-banner.status-secure {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15) 0%, rgba(34, 197, 94, 0.05) 100%);
    border-color: rgba(34, 197, 94, 0.3);
}

.security-banner.status-guarded {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(59, 130, 246, 0.05) 100%);
    border-color: rgba(59, 130, 246, 0.3);
}

.security-banner.status-elevated {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(245, 158, 11, 0.05) 100%);
    border-color: rgba(245, 158, 11, 0.3);
}

.security-banner.status-high {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.15) 0%, rgba(249, 115, 22, 0.05) 100%);
    border-color: rgba(249, 115, 22, 0.3);
}

.security-banner.status-critical {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(239, 68, 68, 0.05) 100%);
    border-color: rgba(239, 68, 68, 0.3);
    animation: pulse-danger 2s infinite;
}

@keyframes pulse-danger {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3); }
    50% { box-shadow: 0 0 20px 5px rgba(239, 68, 68, 0.2); }
}

.banner-icon {
    font-size: 2rem;
    color: var(--success);
}

.status-secure .banner-icon { color: #22c55e; }
.status-guarded .banner-icon { color: #3b82f6; }
.status-elevated .banner-icon { color: #f59e0b; }
.status-high .banner-icon { color: #f97316; }
.status-critical .banner-icon { color: #ef4444; }

.banner-content {
    flex: 1;
}

.banner-content h2 {
    margin: 0 0 4px 0;
    font-size: 1.25rem;
}

.banner-content p {
    margin: 0;
    color: var(--text-secondary);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.stat-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
}

.stat-icon.threats { color: #f59e0b; background: rgba(245, 158, 11, 0.1); }
.stat-icon.blocked { color: #22c55e; background: rgba(34, 197, 94, 0.1); }
.stat-icon.ips { color: #ef4444; background: rgba(239, 68, 68, 0.1); }
.stat-icon.spoofing { color: #8b5cf6; background: rgba(139, 92, 246, 0.1); }

.stat-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Security Grid */
.security-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

@media (max-width: 1024px) {
    .security-grid {
        grid-template-columns: 1fr;
    }
}

.security-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Guardian Stats */
.guardian-stats, .claude-info, .infrastructure-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.guardian-stat, .info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.info-row:last-child {
    border-bottom: none;
}

/* Category Breakdown */
.category-breakdown {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.category-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    font-size: 0.8rem;
}

.cat-count {
    background: var(--primary);
    color: white;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 0.7rem;
}

/* Threats List */
.threats-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
}

.threat-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius);
    border-left: 3px solid var(--text-secondary);
}

.threat-item.critical { border-left-color: #ef4444; }
.threat-item.high { border-left-color: #f59e0b; }
.threat-item.medium { border-left-color: #3b82f6; }
.threat-item.low { border-left-color: #6b7280; }

.threat-icon {
    flex-shrink: 0;
}

.threat-content {
    flex: 1;
    min-width: 0;
}

.threat-type {
    font-weight: 500;
    text-transform: capitalize;
}

.threat-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 4px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.threat-meta {
    display: flex;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Blocked IPs List */
.blocked-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.blocked-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: var(--radius);
}

.ip-address {
    font-family: monospace;
    color: var(--text);
}

/* Health Metrics */
.health-metrics {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}

.metric-item {
    display: grid;
    grid-template-columns: 100px 1fr 50px;
    gap: 12px;
    align-items: center;
}

.metric-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.metric-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.metric-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s;
}

.metric-fill.health-good { background: #22c55e; }
.metric-fill.health-warning { background: #f59e0b; }
.metric-fill.health-danger { background: #ef4444; }

.metric-value {
    font-size: 0.85rem;
    font-weight: 500;
    text-align: right;
}

/* Service Status */
.service-status {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.service-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}

.service-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6b7280;
}

.service-indicator.active { background: #22c55e; }
.service-indicator.warning { background: #f59e0b; }

.service-name {
    flex: 1;
    text-transform: capitalize;
}

.service-status {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Spoofing Card */
.spoofing-card {
    border: 1px solid rgba(139, 92, 246, 0.3);
    background: rgba(139, 92, 246, 0.05);
}

.spoofing-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.spoofing-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius);
}

.spoofing-icon {
    color: #8b5cf6;
}

.spoofing-content {
    flex: 1;
}

.spoofing-ip {
    font-family: monospace;
    font-weight: 500;
}

.spoofing-owner {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.spoofing-analysis {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Analysis Result */
.analysis-result {
    margin-top: 16px;
    padding: 16px;
    border-radius: var(--radius);
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
}

.analysis-result.known {
    border-color: rgba(139, 92, 246, 0.5);
}

.analysis-result h4 {
    margin: 0 0 12px 0;
    font-family: monospace;
}

.result-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
}

.analysis-text {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
    line-height: 1.5;
}

.threat-assessment {
    margin-top: 12px;
    padding: 12px;
    background: rgba(245, 158, 11, 0.1);
    border-radius: var(--radius);
    font-size: 0.85rem;
}

/* =============================================================================
   SYSTEM MONITORING
   ============================================================================= */

.system-monitoring {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.system-monitoring .tab-content {
    display: block !important;
}

/* Loading State */
.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Error State */
.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-secondary);
}

.error-state h2 {
    color: var(--text-primary);
    margin: 16px 0 8px;
}

.error-state p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* Tab Navigation */
.tab-nav {
    display: flex;
    gap: 8px;
    padding: 4px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius);
    width: fit-content;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    border-radius: calc(var(--radius) - 4px);
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    background: var(--primary);
    color: white;
}

/* Health Dashboard */
.health-dashboard {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.info-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.info-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.info-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    border-radius: 12px;
}

.info-content h4 {
    margin: 0 0 4px 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.info-content p {
    margin: 0;
    font-weight: 500;
    color: var(--text-primary);
}

.info-content small {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Resource Meters */
.resource-meters {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

@media (max-width: 768px) {
    .resource-meters {
        grid-template-columns: 1fr;
    }
}

.meter-card {
    padding: 24px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
}

.meter-card h4 {
    margin: 0 0 20px 0;
    color: var(--text-secondary);
}

.meter-visual {
    display: flex;
    justify-content: center;
}

.meter-ring {
    position: relative;
    width: 120px;
    height: 120px;
}

.meter-ring svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.meter-ring .meter-bg {
    stroke: rgba(255, 255, 255, 0.1);
}

.meter-ring .meter-fill {
    stroke: #22c55e;
    stroke-linecap: round;
    transition: stroke-dasharray 0.5s;
}

.meter-ring.meter-warning .meter-fill { stroke: #f59e0b; }
.meter-ring.meter-danger .meter-fill { stroke: #ef4444; }

.meter-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.meter-detail {
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Services Section */
.services-section h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.service-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.service-card .service-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #6b7280;
}

.service-card.service-active .service-indicator {
    background: #22c55e;
}

.service-card.service-warning .service-indicator {
    background: #f59e0b;
}

.service-card.service-inactive .service-indicator {
    background: #ef4444;
}

.service-card.service-active {
    border-color: rgba(34, 197, 94, 0.3);
}

.service-card.service-warning {
    border-color: rgba(245, 158, 11, 0.3);
}

.service-info {
    display: flex;
    flex-direction: column;
}

.service-info .service-name {
    font-weight: 500;
    color: var(--text-primary);
}

.service-info .service-status {
    font-size: 0.8rem;
    text-transform: capitalize;
    color: var(--text-secondary);
}

/* Audit Log */
.audit-log {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.audit-filters {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-group label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.filter-group select {
    padding: 8px 12px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    min-width: 150px;
}

.filter-stats {
    margin-left: auto;
    display: flex;
    gap: 20px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.audit-table-container {
    overflow-x: auto;
    border-radius: var(--radius);
}

.audit-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
}

.audit-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border);
}

.audit-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--text-primary);
}

.audit-row.critical { background: rgba(239, 68, 68, 0.05); }
.audit-row.high { background: rgba(245, 158, 11, 0.05); }

.audit-table .timestamp {
    white-space: nowrap;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.audit-table .ip code {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
}

.audit-table .action-badge {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border-radius: 4px;
    font-size: 0.75rem;
    text-transform: uppercase;
}

/* Simple Table for Modals */
.simple-table {
    width: 100%;
    border-collapse: collapse;
}

.simple-table th,
.simple-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.simple-table th {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-secondary);
}

/* Threats Modal */
.threats-modal {
    max-height: 60vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.threats-modal .filters-row {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}

.threats-modal .threats-table {
    overflow-y: auto;
    flex: 1;
}
