/* MbetterClient Dashboard CSS - Offline-first design */

:root {
    --primary-color: #0d6efd;
    --success-color: #198754;
    --info-color: #0dcaf0;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --dark-color: #212529;
    --light-color: #f8f9fa;
}

/* Global Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
}

.text-small {
    font-size: 0.875rem;
}

/* Navbar customizations */
.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
}

.navbar-nav .nav-link {
    font-weight: 500;
    transition: all 0.3s ease;
}

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

.navbar-nav .nav-link.active {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 0.375rem;
}

/* Status cards */
.card {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
    font-weight: 600;
}

/* Status badges */
.badge {
    font-size: 0.75rem;
    font-weight: 600;
}

/* Buttons */
.btn {
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

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

.btn-outline-primary:hover,
.btn-outline-success:hover,
.btn-outline-info:hover,
.btn-outline-warning:hover {
    transform: translateY(-2px);
}

/* Forms */
.form-control, .form-select {
    border-radius: 0.5rem;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

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

.input-group-text {
    border-radius: 0.5rem 0 0 0.5rem;
    border: 2px solid #e9ecef;
    border-right: none;
    background-color: #f8f9fa;
}

/* Tables */
.table {
    border-collapse: separate;
    border-spacing: 0;
}

.table th {
    border-top: none;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.table td {
    border-top: 1px solid #dee2e6;
    vertical-align: middle;
}

.table-striped > tbody > tr:nth-of-type(odd) > td {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Login page specific styles */
.min-vh-100 {
    min-height: 100vh;
}

.login-card {
    border: none;
    border-radius: 1rem;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175);
}

/* Status bar */
#status-bar {
    z-index: 1000;
    border-top: 1px solid #dee2e6;
    background-color: rgba(248, 249, 250, 0.95);
    backdrop-filter: blur(10px);
}

/* Match Timer Styles */
#match-timer {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-weight: bold;
    font-size: 0.875rem;
    min-width: 60px;
    text-align: center;
    transition: all 0.3s ease;
}

#match-timer-display {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-weight: bold;
    font-size: 1rem;
    min-width: 60px;
    text-align: center;
    transition: all 0.3s ease;
}

/* Navbar timer styling */
.navbar-timer {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 0.5rem;
    padding: 0.375rem 0.75rem;
    color: white;
    font-size: 0.875rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar-timer i {
    color: rgba(255,255,255,0.8);
}

/* Timer animations */
@keyframes timerPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

#match-timer.timer-low {
    animation: timerPulse 1s infinite;
}

#match-timer-display.timer-low {
    animation: timerPulse 1s infinite;
}

/* Timer color states */
#match-timer.bg-danger {
    background: linear-gradient(135deg, #dc3545 0%, #b02a37 100%) !important;
    animation: timerPulse 0.5s infinite;
}

#match-timer.bg-warning {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%) !important;
}

#match-timer-display.text-danger {
    color: #dc3545 !important;
    animation: timerPulse 0.5s infinite;
}

#match-timer-display.text-warning {
    color: #ffc107 !important;
}

/* Offline indicator */
#offline-indicator {
    z-index: 1050;
}

/* Activity list */
#activity-list .flex-shrink-0 i {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.1);
}

/* Video control page */
.video-controls {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 1rem;
    color: white;
}

.video-controls .btn {
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
}

.video-controls .btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: white;
}

/* Template management */
.template-card {
    cursor: pointer;
    transition: all 0.3s ease;
}

.template-card:hover {
    transform: scale(1.02);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.template-preview {
    height: 120px;
    background: linear-gradient(45deg, #f8f9fa, #e9ecef);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #6c757d;
}

/* API tokens page */
.token-item {
    border-left: 4px solid var(--primary-color);
    background-color: #f8f9fa;
}

.token-expired {
    border-left-color: var(--danger-color);
    background-color: #fdf2f2;
}

/* Configuration page */
.config-section {
    border-left: 3px solid var(--primary-color);
    padding-left: 1rem;
}

/* Logs page */
.log-entry {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.4;
}

.log-error {
    color: var(--danger-color);
    background-color: rgba(220, 53, 69, 0.1);
}

.log-warning {
    color: #856404;
    background-color: rgba(255, 193, 7, 0.1);
}

.log-info {
    color: var(--info-color);
}

.log-debug {
    color: #6c757d;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .navbar-nav .dropdown-menu {
        border: none;
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    }
    
    #status-bar {
        display: none !important;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .table-responsive {
        border-radius: 0.5rem;
    }
}

/* Dark mode support (future enhancement) */
@media (prefers-color-scheme: dark) {
    :root {
        --bs-body-bg: #1a1a1a;
        --bs-body-color: #f8f9fa;
    }
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1rem;
    height: 1rem;
    margin: -0.5rem 0 0 -0.5rem;
    border: 2px solid transparent;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Success/Error states */
.success-flash {
    animation: successFlash 0.5s ease-in-out;
}

@keyframes successFlash {
    0% { background-color: rgba(25, 135, 84, 0.1); }
    100% { background-color: transparent; }
}

.error-flash {
    animation: errorFlash 0.5s ease-in-out;
}

@keyframes errorFlash {
    0% { background-color: rgba(220, 53, 69, 0.1); }
    100% { background-color: transparent; }
}

/* Accessibility improvements */
.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Print styles */
@media print {
    .navbar,
    #status-bar,
    .btn,
    .modal {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
    
    .table {
        border-collapse: collapse;
    }
}

/* Utilities */
.opacity-75 {
    opacity: 0.75;
}

.fw-bold {
    font-weight: 600 !important;
}

.text-decoration-none {
    text-decoration: none !important;
}

.cursor-pointer {
    cursor: pointer;
}

.user-select-none {
    user-select: none;
}