/* Universal Hub Dashboard Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.dashboard {
    display: grid;
    grid-template-areas: 
        "header header"
        "overview overview"
        "main sidebar";
    grid-template-columns: 1fr 300px;
    grid-template-rows: auto auto 1fr;
    min-height: 100vh;
    gap: 20px;
    padding: 20px;
}

/* Header */
.header {
    grid-area: header;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 20px 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-title {
    font-size: 2rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 4px;
}

.header-subtitle {
    color: #718096;
    font-size: 0.95rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.system-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #48bb78;
}

.status-indicator.loading {
    background: #ed8936;
    animation: pulse 2s infinite;
}

.status-indicator.error {
    background: #f56565;
}

.refresh-btn, .logout-btn {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.refresh-btn {
    background: rgba(0, 0, 0, 0.05);
    color: #4a5568;
}

.refresh-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: rotate(180deg);
}

.logout-btn {
    background: #e53e3e;
    color: white;
}

.logout-btn:hover {
    background: #c53030;
}

/* Overview Section */
.overview-section {
    grid-area: overview;
}

.overview-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.overview-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.overview-card:hover {
    transform: translateY(-2px);
}

.card-icon {
    font-size: 2rem;
    opacity: 0.8;
}

.card-value {
    font-size: 2rem;
    font-weight: 700;
    color: #2d3748;
}

.card-label {
    font-size: 0.9rem;
    color: #718096;
    font-weight: 500;
}

.overview-card.online .card-value {
    color: #38a169;
}

.overview-card.warning .card-value {
    color: #d69e2e;
}

.overview-card.offline .card-value {
    color: #e53e3e;
}

/* Main Content */
.main-content {
    grid-area: main;
    overflow-y: auto;
}

.services-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.service-category {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.category-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(0, 0, 0, 0.05);
}

.category-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: #2d3748;
}

.category-stats {
    font-size: 0.85rem;
    color: #718096;
    background: rgba(0, 0, 0, 0.05);
    padding: 4px 12px;
    border-radius: 12px;
}

.service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.service-card {
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.service-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: rgba(0, 0, 0, 0.1);
}

.service-card.online {
    border-left: 4px solid #38a169;
}

.service-card.warning {
    border-left: 4px solid #d69e2e;
}

.service-card.offline {
    border-left: 4px solid #e53e3e;
}

.service-card.restarting {
    border-left: 4px solid #3182ce;
}

.service-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.service-info {
    flex: 1;
}

.service-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.service-icon {
    font-size: 1.2rem;
}

.service-description {
    font-size: 0.9rem;
    color: #718096;
    line-height: 1.4;
}

.service-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 12px;
}

.service-status.online {
    background: rgba(56, 161, 105, 0.1);
    color: #38a169;
}

.service-status.warning {
    background: rgba(214, 158, 46, 0.1);
    color: #d69e2e;
}

.service-status.offline {
    background: rgba(229, 62, 62, 0.1);
    color: #e53e3e;
}

.service-status.restarting {
    background: rgba(49, 130, 206, 0.1);
    color: #3182ce;
}

.service-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.service-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.service-btn.primary {
    background: #4299e1;
    color: white;
}

.service-btn.primary:hover {
    background: #3182ce;
}

.service-btn.secondary {
    background: rgba(0, 0, 0, 0.05);
    color: #4a5568;
}

.service-btn.secondary:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* Activity Sidebar */
.activity-sidebar {
    grid-area: sidebar;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.activity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(0, 0, 0, 0.05);
}

.activity-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2d3748;
}

.activity-refresh {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
}

.activity-refresh:hover {
    background: rgba(0, 0, 0, 0.05);
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.activity-item {
    padding: 12px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
    border-left: 3px solid #e2e8f0;
}

.activity-item.error {
    border-left-color: #e53e3e;
    background: rgba(229, 62, 62, 0.05);
}

.activity-item.warning {
    border-left-color: #d69e2e;
    background: rgba(214, 158, 46, 0.05);
}

.activity-item.success {
    border-left-color: #38a169;
    background: rgba(56, 161, 105, 0.05);
}

.activity-service {
    font-weight: 600;
    color: #2d3748;
    font-size: 0.9rem;
}

.activity-status {
    font-size: 0.8rem;
    color: #718096;
    margin: 4px 0;
}

.activity-time {
    font-size: 0.75rem;
    color: #a0aec0;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 30px;
    border-bottom: 1px solid #e2e8f0;
}

.modal-header h3 {
    font-size: 1.4rem;
    font-weight: 600;
    color: #2d3748;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #718096;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #2d3748;
}

.modal-body {
    padding: 24px 30px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 30px;
    border-top: 1px solid #e2e8f0;
    background: #f7fafc;
    border-radius: 0 0 16px 16px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
}

.btn.primary {
    background: #4299e1;
    color: white;
}

.btn.primary:hover {
    background: #3182ce;
}

.btn.secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn.secondary:hover {
    background: #cbd5e0;
}

.btn.warning {
    background: #ed8936;
    color: white;
}

.btn.warning:hover {
    background: #dd6b20;
}

/* Loading */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 20px;
}

.loading-overlay.show {
    display: flex;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #4299e1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Access Denied Page */
.access-denied-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.access-denied-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.access-denied-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.access-denied-content h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 16px;
}

.access-denied-content p {
    color: #718096;
    line-height: 1.6;
    margin-bottom: 16px;
}

.access-denied-details {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    padding: 20px;
    margin: 24px 0;
    text-align: left;
}

.access-denied-details h3 {
    color: #2d3748;
    margin-bottom: 12px;
}

.access-denied-details code {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', monospace;
}

.access-denied-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
}

/* Animations */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 1200px) {
    .dashboard {
        grid-template-areas: 
            "header"
            "overview"
            "main"
            "sidebar";
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr auto;
    }
    
    .activity-sidebar {
        max-height: 400px;
    }
}

@media (max-width: 768px) {
    .dashboard {
        padding: 10px;
        gap: 15px;
    }
    
    .header {
        padding: 15px 20px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .header-title {
        font-size: 1.5rem;
    }
    
    .overview-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .overview-card {
        padding: 16px;
    }
    
    .service-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 20px;
    }
}