/* RAK Phase 3 - Custom Styles */

:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --info-color: #0dcaf0;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    
    --border-radius: 0.375rem;
    --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --box-shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
    
    --transition-fast: 0.15s ease-in-out;
    --transition-smooth: 0.3s ease-in-out;
}

/* Global Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: #f8f9fa;
}

/* Card Enhancements */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: all var(--transition-smooth);
}

.card:hover {
    box-shadow: var(--box-shadow-lg);
}

.card-header {
    background: linear-gradient(135deg, var(--primary-color), #0b5ed7);
    color: white;
    border-radius: var(--border-radius) var(--border-radius) 0 0 !important;
}

/* Navigation Enhancements */
.navbar {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
}

.nav-link {
    transition: all var(--transition-fast);
}

.nav-link:hover {
    transform: translateY(-1px);
}

/* Button Enhancements */
.btn {
    border-radius: var(--border-radius);
    transition: all var(--transition-fast);
    font-weight: 500;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #0b5ed7);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0b5ed7, #0a58ca);
    border-color: #0a58ca;
}

/* Form Enhancements */
.form-control, .form-select {
    border-radius: var(--border-radius);
    border: 1px solid #dee2e6;
    transition: all var(--transition-fast);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Application Cards */
.app-card {
    transition: all var(--transition-smooth);
    cursor: pointer;
    border: 1px solid #e9ecef;
    position: relative;
    overflow: hidden;
}

.app-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--info-color));
    transform: translateX(-100%);
    transition: transform var(--transition-smooth);
}

.app-card:hover::before {
    transform: translateX(0);
}

.app-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-color: var(--primary-color);
}

.app-card .card-body {
    padding: 1.5rem;
}

.app-card .card-title {
    color: var(--dark-color);
    margin-bottom: 0.75rem;
}

.app-card .card-text {
    color: var(--secondary-color);
    font-size: 0.875rem;
    line-height: 1.5;
}

/* Badge Enhancements */
.badge {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: 2rem;
}

/* Login Page */
.login-container {
    background: linear-gradient(135deg, var(--primary-color), #0b5ed7);
    min-height: 100vh;
}

.login-card {
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
}

/* Dashboard Stats */
.stats-card {
    background: linear-gradient(135deg, var(--primary-color), #0b5ed7);
    color: white;
    border: none;
    position: relative;
    overflow: hidden;
}

.stats-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(30px, -30px);
}

.stats-number {
    font-size: 2.5rem;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Activity Timeline */
.timeline {
    position: relative;
}

.timeline-item {
    position: relative;
    padding-left: 2rem;
    margin-bottom: 1.5rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 2px;
    height: 100%;
    background-color: #e9ecef;
}

.timeline-item:last-child::before {
    display: none;
}

.timeline-icon {
    position: absolute;
    left: -8px;
    top: 0;
    width: 16px;
    height: 16px;
    background-color: var(--primary-color);
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Quick Access Bar */
.quick-access-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(13, 110, 253, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1050;
    padding: 1rem 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

.quick-access-item {
    transition: all var(--transition-fast);
    padding: 0.5rem 1rem;
    margin: 0 0.25rem;
    border-radius: var(--border-radius);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    text-decoration: none;
}

.quick-access-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    color: white;
}

/* Admin Panel */
.admin-sidebar {
    background: linear-gradient(180deg, var(--dark-color), #343a40);
    color: white;
    min-height: calc(100vh - 76px);
}

.admin-nav-link {
    color: rgba(255, 255, 255, 0.8);
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 0.25rem;
    transition: all var(--transition-fast);
}

.admin-nav-link:hover,
.admin-nav-link.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateX(5px);
}

/* Data Tables */
.table {
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
}

.table thead th {
    background: linear-gradient(135deg, var(--primary-color), #0b5ed7);
    color: white;
    border: none;
    font-weight: 600;
    padding: 1rem;
}

.table tbody td {
    padding: 1rem;
    border-color: #e9ecef;
    vertical-align: middle;
}

.table tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.05);
}

/* Search and Filters */
.search-box {
    position: relative;
}

.search-box .form-control {
    padding-left: 2.5rem;
}

.search-box .search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary-color);
    z-index: 5;
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* Responsive Design */
@media (max-width: 768px) {
    .navbar-brand {
        font-size: 1.25rem;
    }
    
    .app-card {
        margin-bottom: 1rem;
    }
    
    .stats-number {
        font-size: 2rem;
    }
    
    .quick-access-bar {
        display: none !important;
    }
}

@media (max-width: 576px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --dark-color: #f8f9fa;
        --light-color: #212529;
    }
    
    body {
        background-color: var(--dark-color);
        color: var(--light-color);
    }
    
    .card {
        background-color: #343a40;
        color: var(--light-color);
    }
    
    .table tbody tr:hover {
        background-color: rgba(255, 255, 255, 0.05);
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

.bounce-in {
    animation: bounceIn 0.6s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Utility Classes */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-color), var(--info-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-custom {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

.border-gradient {
    border: 2px solid transparent;
    background: linear-gradient(white, white) padding-box,
                linear-gradient(135deg, var(--primary-color), var(--info-color)) border-box;
}

/* ============================================================================
   PHASE 4 - Enhanced Admin Interface and Monitoring Styles
   ============================================================================ */

/* Real-time Stats Animation */
.stat-updated {
    animation: statPulse 0.5s ease-in-out;
    background: rgba(25, 135, 84, 0.1) !important;
    border-radius: 4px;
    transition: all var(--transition-fast);
}

@keyframes statPulse {
    0% {
        background: rgba(25, 135, 84, 0.3);
        transform: scale(1);
    }
    50% {
        background: rgba(25, 135, 84, 0.5);
        transform: scale(1.02);
    }
    100% {
        background: rgba(25, 135, 84, 0.1);
        transform: scale(1);
    }
}

/* System Status Indicators */
.system-status {
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.system-status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: statusPulse 2s infinite;
}

.status-healthy::before {
    background-color: var(--success-color);
}

.status-degraded::before {
    background-color: var(--warning-color);
}

.status-unhealthy::before {
    background-color: var(--danger-color);
}

.status-unknown::before {
    background-color: var(--secondary-color);
}

@keyframes statusPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.9);
    }
}

/* Monitoring Dashboard Styles */
.monitoring-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all var(--transition-smooth);
}

.monitoring-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.metric-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

.metric-label {
    font-size: 0.875rem;
    color: var(--secondary-color);
    font-weight: 500;
    margin-top: 0.25rem;
}

.metric-change {
    font-size: 0.75rem;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    margin-top: 0.25rem;
    display: inline-block;
}

.metric-change.positive {
    background: rgba(25, 135, 84, 0.1);
    color: var(--success-color);
}

.metric-change.negative {
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
}

/* Activity Timeline */
.activity-timeline {
    position: relative;
    padding-left: 1.5rem;
}

.activity-timeline::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--primary-color), rgba(13, 110, 253, 0.1));
}

.activity-item {
    position: relative;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.activity-item::before {
    content: '';
    position: absolute;
    left: -0.25rem;
    top: 0.25rem;
    width: 0.5rem;
    height: 0.5rem;
    background: var(--primary-color);
    border-radius: 50%;
    border: 2px solid white;
    z-index: 2;
}

.activity-time {
    font-size: 0.75rem;
    color: var(--secondary-color);
    font-weight: 500;
}

.activity-content {
    margin-top: 0.25rem;
}

/* Audit Log Styles */
.audit-event {
    border-left: 3px solid transparent;
    padding-left: 1rem;
    transition: all var(--transition-fast);
}

.audit-event.event-login {
    border-left-color: var(--info-color);
}

.audit-event.event-access {
    border-left-color: var(--success-color);
}

.audit-event.event-admin {
    border-left-color: var(--warning-color);
}

.audit-event.event-error {
    border-left-color: var(--danger-color);
}

.audit-event:hover {
    background: rgba(13, 110, 253, 0.05);
    border-radius: 0.25rem;
}

/* Chart Container Styles */
.chart-container {
    position: relative;
    height: 300px;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.chart-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid rgba(13, 110, 253, 0.1);
}

/* Phase 4 Button Enhancements */
.btn-monitoring {
    background: linear-gradient(135deg, #6f42c1, #e83e8c);
    border: none;
    color: white;
    transition: all var(--transition-smooth);
}

.btn-monitoring:hover {
    background: linear-gradient(135deg, #5a2d91, #d91a72);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(111, 66, 193, 0.4);
}

/* Loading States for Phase 4 */
.loading-shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

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

/* Responsive Monitoring Grid */
.monitoring-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Phase 4 Dark Mode Enhancements */
[data-bs-theme="dark"] .monitoring-card {
    background: rgba(33, 37, 41, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .metric-value {
    color: #66d9ff;
}

[data-bs-theme="dark"] .chart-container {
    background: rgba(33, 37, 41, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Real-time Indicator */
.real-time-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1050;
    padding: 0.5rem 1rem;
    background: rgba(25, 135, 84, 0.9);
    color: white;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    opacity: 0;
    transform: translateY(-10px);
    transition: all var(--transition-smooth);
}

.real-time-indicator.active {
    opacity: 1;
    transform: translateY(0);
}

.real-time-indicator::before {
    content: '●';
    margin-right: 0.5rem;
    animation: statusPulse 1s infinite;
}

/* Last Refresh Timestamp */
.last-refresh {
    font-size: 0.75rem;
    color: var(--secondary-color);
    font-style: italic;
}