/* 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;
}

/* Thermal Receipt Printer Styles */
.thermal-receipt {
    font-family: 'Courier New', monospace;
    background-color: #ffffff;
    color: #000000;
    max-width: 350px;
    margin: 0 auto;
}

.thermal-receipt-content {
    width: 100%;
    padding: 15px;
    font-size: 12px;
    line-height: 1.3;
}

.receipt-header {
    text-align: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #000;
}

.receipt-logo {
    font-size: 32px;
    margin-bottom: 8px;
}

.boxing-glove {
    color: #000000;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.receipt-title {
    font-size: 24px;
    font-weight: bold;
    letter-spacing: 3px;
    margin-bottom: 5px;
}

.receipt-subtitle {
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.receipt-separator {
    text-align: center;
    margin: 12px 0;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: -1px;
}

.receipt-info,
.receipt-bets,
.receipt-total {
    margin: 15px 0;
}

.receipt-row,
.receipt-bet-line,
.receipt-total-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 3px;
    font-size: 12px;
}

.receipt-bet-item {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px dashed #000;
}

.receipt-bet-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.receipt-match {
    font-weight: bold;
    font-size: 14px;
    text-align: center;
    margin-bottom: 5px;
}

.receipt-match-details {
    font-size: 11px;
    text-align: center;
    margin-bottom: 3px;
}

.receipt-venue {
    font-size: 10px;
    text-align: center;
    margin-bottom: 5px;
    color: #333;
}

.receipt-status {
    font-size: 10px;
    text-align: center;
    margin-top: 5px;
    font-weight: bold;
}

.receipt-total {
    border-top: 2px solid #000;
    padding-top: 10px;
    font-weight: bold;
    font-size: 14px;
}

.receipt-qr {
    text-align: center;
    margin: 20px 0;
    padding: 15px 0;
    border-top: 1px solid #000;
    border-bottom: 1px solid #000;
}

.receipt-barcode {
    text-align: center;
    margin: 20px 0;
    padding: 15px 0;
    border-top: 1px solid #000;
    border-bottom: 1px solid #000;
}

.qr-code {
    margin: 10px 0;
}

.qr-image {
    width: 100px;
    height: 100px;
    border: 1px solid #ccc;
}

.qr-text {
    font-size: 10px;
    margin-top: 8px;
    font-style: italic;
}

.receipt-footer {
    text-align: center;
    font-size: 10px;
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #000;
    line-height: 1.4;
}

.receipt-timestamp {
    margin-top: 10px;
    font-size: 9px;
    color: #666;
    font-style: italic;
}

/* Modal styling for thermal receipt */
#printReceiptModal .modal-dialog {
    max-width: 400px;
}

#printReceiptModal .modal-body {
    max-height: 70vh;
    overflow-y: auto;
    padding: 0;
}

/* Print-specific styles for thermal receipt */
@media print {
    .thermal-receipt-content {
        max-width: 300px;
        margin: 0 auto;
        padding: 10px;
        font-size: 11px;
    }
    
    .receipt-header {
        margin-bottom: 10px;
        padding-bottom: 8px;
    }
    
    .receipt-logo {
        font-size: 24px;
        margin-bottom: 5px;
    }
    
    .receipt-title {
        font-size: 18px;
        margin-bottom: 3px;
    }
    
    .receipt-subtitle {
        font-size: 12px;
        margin-bottom: 5px;
    }
    
    .receipt-separator {
        margin: 8px 0;
        font-size: 10px;
    }
    
    .receipt-info, .receipt-bets, .receipt-total {
        margin: 10px 0;
    }
    
    .receipt-row, .receipt-bet-line, .receipt-total-line {
        font-size: 11px;
        margin-bottom: 2px;
    }
    
    .receipt-bet-item {
        margin-bottom: 8px;
        padding-bottom: 5px;
    }
    
    .receipt-match {
        font-size: 12px;
        margin-bottom: 3px;
    }
    
    .receipt-match-details {
        font-size: 10px;
        margin-bottom: 2px;
    }
    
    .receipt-venue {
        font-size: 9px;
        margin-bottom: 3px;
    }
    
    .receipt-status {
        font-size: 9px;
        margin-top: 2px;
    }
    
    .receipt-total {
        padding-top: 5px;
        font-size: 12px;
    }
    
    .receipt-qr {
        margin: 10px 0;
        padding: 8px 0;
    }
    
    .receipt-barcode {
        text-align: center;
        margin: 10px 0;
        padding: 8px 0;
    }
    
    .qr-image {
        width: 80px;
        height: 80px;
    }
    
    .qr-text {
        font-size: 8px;
        margin-top: 5px;
    }
    
    .receipt-footer {
        font-size: 9px;
        margin-top: 10px;
        padding-top: 5px;
    }
    
    .receipt-timestamp {
        margin-top: 5px;
        font-size: 8px;
    }
    
    /* Hide modal elements during print */
    .modal-header,
    .modal-footer,
    .btn,
    body > *:not(.modal) {
        display: none !important;
    }
    
    .modal,
    .modal-dialog,
    .modal-content,
    .modal-body {
        display: block !important;
        position: static !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        border: none !important;
        background: white !important;
        width: 100% !important;
        max-width: 100% !important;
    }
}