/* 
 * Modern Custom Styles for VSOL EMS
 * Enhanced for PHP 8.2 version with modern features
 */

/* Base Layout */
body { 
    padding-top: 60px; 
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
}

.main-content { 
    min-height: calc(100vh - 120px); 
    padding-bottom: 80px;
}

/* Enhanced Navigation */
.navbar-default { 
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    border: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
}

.navbar-default .navbar-brand { 
    color: #ecf0f1 !important; 
    font-weight: 700; 
    font-size: 20px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.navbar-default .navbar-brand .version-badge {
    font-size: 10px;
    background: #3498db;
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 8px;
    vertical-align: super;
}

.navbar-default .navbar-nav > li > a { 
    color: #bdc3c7 !important; 
    font-weight: 500;
    transition: all 0.3s ease;
    border-radius: 4px;
    margin: 0 2px;
}

.navbar-default .navbar-nav > li > a:hover,
.navbar-default .navbar-nav > li > a:focus { 
    color: #3498db !important; 
    background-color: rgba(52, 152, 219, 0.1);
    transform: translateY(-1px);
}

.navbar-default .navbar-nav > .active > a { 
    color: #3498db !important; 
    background-color: rgba(52, 152, 219, 0.2);
}

/* System Health Indicator */
.health-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    animation: pulse 2s infinite;
}

.health-indicator.online {
    background-color: #27ae60;
    box-shadow: 0 0 6px rgba(39, 174, 96, 0.6);
}

.health-indicator.offline {
    background-color: #e74c3c;
    animation: none;
}

.health-indicator.warning {
    background-color: #f39c12;
}

/* Enhanced Cards */
.info-card { 
    background: #ffffff; 
    border-radius: 12px; 
    box-shadow: 0 4px 20px rgba(0,0,0,0.08); 
    padding: 25px; 
    margin-bottom: 25px; 
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.info-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #3498db, #2ecc71);
}

.info-card:hover { 
    transform: translateY(-4px) scale(1.02); 
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}

.info-card .card-icon { 
    font-size: 42px; 
    background: linear-gradient(135deg, #3498db, #2ecc71);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 15px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.info-card .card-value { 
    font-size: 36px; 
    font-weight: 700; 
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 15px 0;
    text-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.info-card .card-label { 
    color: #7f8c8d; 
    font-size: 14px; 
    text-transform: uppercase; 
    letter-spacing: 1.2px;
    font-weight: 600;
}

/* Enhanced Status Indicators */
.status-online {
    color: #27ae60;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(39, 174, 96, 0.3);
}

.status-offline {
    color: #e74c3c;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(231, 76, 60, 0.3);
}

.status-connecting {
    color: #f39c12;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(243, 156, 18, 0.3);
}

.status-indicator {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    margin-right: 10px;
    position: relative;
}

.status-indicator.online {
    background: radial-gradient(circle, #27ae60, #2ecc71);
    animation: pulse-glow 2s infinite;
    box-shadow: 0 0 8px rgba(39, 174, 96, 0.4);
}

.status-indicator.offline {
    background: radial-gradient(circle, #e74c3c, #c0392b);
    box-shadow: 0 0 8px rgba(231, 76, 60, 0.4);
}

.status-indicator.connecting {
    background: radial-gradient(circle, #f39c12, #e67e22);
    animation: pulse-warning 1s infinite;
    box-shadow: 0 0 8px rgba(243, 156, 18, 0.4);
}

/* Modern Animations */
@keyframes pulse-glow {
    0% { 
        opacity: 1; 
        transform: scale(1);
    }
    50% { 
        opacity: 0.7; 
        transform: scale(1.1);
    }
    100% { 
        opacity: 1; 
        transform: scale(1);
    }
}

@keyframes pulse-warning {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.4; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Enhanced Panels */
.panel-enhanced { 
    border: none; 
    border-radius: 12px; 
    box-shadow: 0 4px 20px rgba(0,0,0,0.08); 
    margin-bottom: 25px;
    overflow: hidden;
    animation: fadeInUp 0.5s ease-out;
}

.panel-enhanced .panel-heading { 
    background: linear-gradient(135deg, #34495e, #2c3e50); 
    color: #ffffff; 
    border-radius: 0;
    padding: 18px 25px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.panel-enhanced .panel-title { 
    font-weight: 600; 
    font-size: 16px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.panel-enhanced .panel-title .glyphicon {
    margin-right: 10px;
    opacity: 0.9;
}

.panel-enhanced .panel-body { 
    padding: 25px;
    background: #ffffff;
}

/* Page Header */
.page-header { 
    border-bottom: 3px solid #3498db; 
    margin-bottom: 35px; 
    padding-bottom: 20px;
    position: relative;
}

.page-header::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 100px;
    height: 3px;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    border-radius: 2px;
}

.page-header h1 { 
    color: #2c3e50; 
    margin-bottom: 8px;
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.page-header small {
    color: #7f8c8d;
    font-weight: 400;
}

.page-actions {
    margin-top: 10px;
}

/* Enhanced Tables */
.table-enhanced {
    margin-bottom: 0;
}

.table-enhanced > thead > tr > th {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    color: #2c3e50;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 1px;
    border-top: none;
    padding: 15px 12px;
}

.table-enhanced > tbody > tr {
    transition: all 0.2s ease;
}

.table-enhanced > tbody > tr:hover {
    background-color: #f8f9fa;
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.table-enhanced > tbody > tr > td {
    padding: 12px;
    vertical-align: middle;
    border-top: 1px solid #e9ecef;
}

/* Command Terminal */
.command-terminal { 
    background: linear-gradient(135deg, #1e2a3a, #2c3e50); 
    color: #ecf0f1; 
    font-family: 'Fira Code', 'Courier New', Monaco, monospace; 
    padding: 25px; 
    border-radius: 12px; 
    margin: 25px 0; 
    min-height: 350px; 
    max-height: 600px; 
    overflow-y: auto;
    position: relative;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.3);
}

.command-terminal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: linear-gradient(90deg, #e74c3c, #f39c12, #27ae60);
    border-radius: 12px 12px 0 0;
}

.command-terminal::after {
    content: '● ● ●';
    position: absolute;
    top: 8px;
    left: 15px;
    color: #2c3e50;
    font-size: 12px;
    letter-spacing: 4px;
}

.command-line { 
    margin-bottom: 8px;
    line-height: 1.6;
    animation: fadeInUp 0.3s ease-out;
}

.command-prompt { 
    color: #3498db; 
    font-weight: 700;
    text-shadow: 0 0 8px rgba(52, 152, 219, 0.5);
}

.command-input {
    color: #ecf0f1;
    margin-left: 8px;
}

.command-output { 
    color: #2ecc71; 
    white-space: pre-wrap; 
    margin-left: 25px;
    text-shadow: 0 0 5px rgba(46, 204, 113, 0.3);
}

.command-error { 
    color: #e74c3c; 
    white-space: pre-wrap; 
    margin-left: 25px;
    text-shadow: 0 0 5px rgba(231, 76, 60, 0.3);
}

/* Enhanced Forms */
.form-enhanced { 
    background: #ffffff; 
    padding: 35px; 
    border-radius: 12px; 
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    position: relative;
}

.form-enhanced::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    border-radius: 12px 12px 0 0;
}

.form-enhanced .form-group label { 
    font-weight: 600; 
    color: #2c3e50; 
    margin-bottom: 10px;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 1px;
}

.form-enhanced .form-control { 
    border: 2px solid #e8f4fd; 
    border-radius: 8px; 
    padding: 15px 18px; 
    font-size: 14px;
    transition: all 0.3s ease;
    background-color: #f8f9fa;
}

.form-enhanced .form-control:focus { 
    border-color: #3498db; 
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    background-color: #ffffff;
    transform: translateY(-1px);
}

.form-enhanced .has-error .form-control {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

/* Enhanced Buttons */
.btn {
    border-radius: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, #3498db, #2980b9);
    border: none;
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2980b9, #1f5582);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    border: none;
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
}

.btn-warning {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    border: none;
    box-shadow: 0 4px 15px rgba(243, 156, 18, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    border: none;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

.btn-info {
    background: linear-gradient(135deg, #5bc0de, #46b8da);
    border: none;
    box-shadow: 0 4px 15px rgba(91, 192, 222, 0.3);
}

/* Enhanced Alerts */
.alert {
    border: none;
    border-radius: 10px;
    padding: 20px 25px;
    margin-bottom: 25px;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.alert::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 4px;
    background: currentColor;
}

.alert-success {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    color: #155724;
    border-left: 4px solid #27ae60;
}

.alert-danger {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    color: #721c24;
    border-left: 4px solid #e74c3c;
}

.alert-warning {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    color: #856404;
    border-left: 4px solid #f39c12;
}

.alert-info {
    background: linear-gradient(135deg, #d1ecf1, #bee5eb);
    color: #0c5460;
    border-left: 4px solid #5bc0de;
}

/* Enhanced Labels */
.label {
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 1px;
}

.label-success {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    box-shadow: 0 2px 8px rgba(39, 174, 96, 0.3);
}

.label-danger {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

.label-warning {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    box-shadow: 0 2px 8px rgba(243, 156, 18, 0.3);
}

.label-info {
    background: linear-gradient(135deg, #5bc0de, #46b8da);
    box-shadow: 0 2px 8px rgba(91, 192, 222, 0.3);
}

/* Sidebar Enhancements */
.sidebar {
    padding-right: 0;
}

.sidebar .panel {
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

.sidebar .list-group-item {
    border: none;
    padding: 12px 18px;
    transition: all 0.3s ease;
    color: #2c3e50;
    text-decoration: none;
}

.sidebar .list-group-item:hover {
    background-color: #3498db;
    color: #ffffff;
    transform: translateX(5px);
}

.sidebar .list-group-item .glyphicon {
    margin-right: 10px;
    width: 16px;
}

/* Footer */
.footer { 
    background: linear-gradient(135deg, #2c3e50, #34495e); 
    color: #bdc3c7; 
    padding: 25px 0; 
    margin-top: 50px; 
    border-top: 4px solid #3498db;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

.footer p { 
    margin: 0; 
    font-size: 13px;
}

.footer .separator {
    margin: 0 8px;
    opacity: 0.5;
}

/* Loading States */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(44, 62, 80, 0.9);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-content {
    text-align: center;
    color: #ecf0f1;
}

.loading-spinner,
.loading-spinner-large {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

.loading-spinner-large {
    width: 60px;
    height: 60px;
    border-width: 6px;
}

.loading-text {
    font-size: 16px;
    font-weight: 500;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Progress Bars */
.progress {
    height: 25px;
    border-radius: 12px;
    background-color: #e9ecef;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.progress-bar {
    background: linear-gradient(90deg, #3498db, #2ecc71);
    transition: width 0.8s ease;
    border-radius: 12px;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 25%, rgba(255,255,255,0.1) 25%, rgba(255,255,255,0.1) 50%, transparent 50%, transparent 75%, rgba(255,255,255,0.1) 75%);
    background-size: 30px 30px;
    animation: progress-stripes 1s linear infinite;
}

@keyframes progress-stripes {
    from { background-position: 0 0; }
    to { background-position: 30px 0; }
}

.progress-bar-success {
    background: linear-gradient(90deg, #27ae60, #2ecc71);
}

.progress-bar-warning {
    background: linear-gradient(90deg, #f39c12, #e67e22);
}

.progress-bar-danger {
    background: linear-gradient(90deg, #e74c3c, #c0392b);
}

/* Enhanced Dropdowns */
.dropdown-menu {
    border: none;
    border-radius: 10px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    padding: 8px 0;
    margin-top: 8px;
    animation: fadeInUp 0.2s ease-out;
}

.dropdown-menu > li > a {
    padding: 10px 20px;
    transition: all 0.2s ease;
    color: #2c3e50;
}

.dropdown-menu > li > a:hover {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: #ffffff;
    transform: translateX(5px);
}

.dropdown-menu .divider {
    margin: 8px 0;
    background-color: #e9ecef;
}

/* Status Statistics */
.status-stat {
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.status-stat:hover {
    transform: scale(1.05);
}

.status-number {
    font-size: 42px;
    font-weight: 700;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.status-label {
    font-size: 14px;
    color: #7f8c8d;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Command History */
.command-entry {
    margin-bottom: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #3498db;
    transition: all 0.3s ease;
}

.command-entry:hover {
    background: #e3f2fd;
    transform: translateX(5px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.command-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.command-text {
    flex: 1;
    font-family: 'Courier New', monospace;
    background: #2c3e50;
    color: #ecf0f1;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.command-meta {
    font-size: 12px;
    color: #7f8c8d;
}

.command-separator {
    margin: 15px 0;
    border-color: #e9ecef;
}

/* Responsive Design */
@media (max-width: 768px) {
    body { 
        padding-top: 50px; 
    }
    
    .info-card { 
        margin-bottom: 20px; 
        padding: 20px; 
    }
    
    .info-card .card-icon {
        font-size: 36px;
    }
    
    .info-card .card-value {
        font-size: 28px;
    }
    
    .form-enhanced { 
        padding: 25px 20px; 
    }
    
    .command-terminal {
        padding: 20px 15px;
        min-height: 250px;
    }
    
    .page-header h1 {
        font-size: 24px;
    }
    
    .navbar-brand .version-badge {
        display: none;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 0 10px;
    }
    
    .panel-enhanced .panel-body {
        padding: 15px;
    }
    
    .info-card {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .btn {
        padding: 8px 12px;
        font-size: 12px;
    }
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    .form-enhanced .form-control {
        background-color: #34495e;
        color: #ecf0f1;
        border-color: #4a5f7a;
    }
    
    .form-enhanced .form-control:focus {
        background-color: #2c3e50;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .sidebar,
    .footer,
    .btn,
    .page-actions {
        display: none !important;
    }
    
    .main-content {
        padding: 0;
        margin: 0;
    }
    
    .main-panel {
        width: 100% !important;
        float: none !important;
    }
    
    .panel-enhanced {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* Accessibility Improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Focus indicators */
.btn:focus,
.form-control:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .info-card {
        border: 2px solid #2c3e50;
    }
    
    .btn {
        border: 2px solid currentColor;
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Utility Classes */
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.pt-20 { padding-top: 20px; }
.pb-20 { padding-bottom: 20px; }

.text-gradient {
    background: linear-gradient(135deg, #3498db, #2ecc71);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-soft {
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.shadow-strong {
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}

.border-gradient {
    border: 2px solid transparent;
    background: linear-gradient(white, white) padding-box,
                linear-gradient(135deg, #3498db, #2ecc71) border-box;
}

/* Custom Scrollbars */
.command-terminal::-webkit-scrollbar,
.table-responsive::-webkit-scrollbar {
    width: 8px;
}

.command-terminal::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

.command-terminal::-webkit-scrollbar-thumb {
    background: rgba(52, 152, 219, 0.6);
    border-radius: 4px;
}

.command-terminal::-webkit-scrollbar-thumb:hover {
    background: rgba(52, 152, 219, 0.8);
}