/**
 * Ban Key Pro - VPS Monitoring System
 * Styles for Telegram configuration form and monitoring toggle
 * 
 * @package Ban_Key_Pro
 * @version 1.0
 */

/* ========================================
   TELEGRAM CONFIGURATION FORM
   ======================================== */

.ban-key-pro-telegram-container {
    margin-top: 30px;
}

/* Input styling */
.bkp-input {
    color: #333 !important;
}

.bkp-input::placeholder {
    color: #cbd5e0 !important;
    opacity: 0.6 !important;
}

/* Input focus effects */
.bkp-input:focus {
    outline: none;
    border-color: #667eea !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
}

/* Button hover effects - Edit button */
#bkp-edit-telegram:hover {
    background: #5568d3 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Button hover effects - Test button */
#bkp-test-telegram:hover {
    background: #059669 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* Button hover effects - Delete button */
#bkp-delete-telegram:hover {
    background: #dc2626 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Button hover effects - Cancel button */
#bkp-cancel-edit-telegram:hover {
    background: #6b7280 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(156, 163, 175, 0.3);
}

/* Button hover effects - Save button (like "Mua Key" button) */
#bkp-save-telegram:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
}

/* Button active state */
#bkp-save-telegram:active,
#bkp-edit-telegram:active,
#bkp-test-telegram:active,
#bkp-delete-telegram:active,
#bkp-cancel-edit-telegram:active {
    transform: translateY(0);
}

/* Message styling */
.bkp-message {
    padding: 12px 15px;
    border-radius: 6px;
    font-size: 14px;
}

.bkp-message.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.bkp-message.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

/* ========================================
   MONITORING TOGGLE BUTTON
   ======================================== */

.bkp-toggle-monitor {
    display: inline-block;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 88px;
    text-transform: uppercase;
    letter-spacing: 0;
}

.bkp-monitor-actions {
    display: inline-flex;
    flex-direction: column; /* stack OFF + HISTORY */
    gap: 4px;
    align-items: stretch;
    justify-content: center;
    width: 100%;
}

.bkp-history-btn {
    display: inline-block;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 88px;
    text-transform: uppercase;
    letter-spacing: 0;
    background: #e0e0e0;
    color: #777;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.bkp-history-btn:hover:not(:disabled) {
    background: #d0d0d0;
    color: #555;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.bkp-history-btn.enabled {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.bkp-history-btn.enabled:hover:not(:disabled) {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.bkp-history-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* OFF state (default) - lighter, harmonious with table colors */
.bkp-toggle-monitor {
    background: #f3f4f6;
    color: #6b7280;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.bkp-toggle-monitor:hover:not(:disabled) {
    background: #e5e7eb;
    color: #4b5563;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ON state (enabled) - lighter red, harmonious */
.bkp-toggle-monitor.enabled {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
    color: #fff;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.25);
}

.bkp-toggle-monitor.enabled:hover:not(:disabled) {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(239, 68, 68, 0.3);
}

/* Disabled state */
.bkp-toggle-monitor:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Loading state */
.bkp-toggle-monitor.loading {
    position: relative;
    color: transparent;
}

.bkp-toggle-monitor.loading::after {
    content: "";
    position: absolute;
    width: 12px;
    height: 12px;
    top: 50%;
    left: 50%;
    margin-left: -6px;
    margin-top: -6px;
    border: 2px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: bkp-spinner 0.6s linear infinite;
}

@keyframes bkp-spinner {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   FLOATING MESSAGE
   ======================================== */

.bkp-floating-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 999999;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
}

.bkp-floating-message.show {
    opacity: 1;
    transform: translateY(0);
}

.bkp-floating-success {
    background: #28a745;
    color: #fff;
}

.bkp-floating-error {
    background: #dc3545;
    color: #fff;
}

/* ========================================
   TABLE COLUMN STYLING
   ======================================== */

/* Offline Alert column header */
th.bkp-offline-alert-header {
    text-align: center;
    font-weight: 600;
    font-size: 13px;
    padding: 8px 8px !important;
}

/* Offline Alert column cell */
td.bkp-offline-alert-cell {
    text-align: center;
    vertical-align: middle;
    padding: 8px 8px !important;
}

/* Give Offline Alert column more room */
th.bkp-offline-alert-header,
td.bkp-offline-alert-cell {
    min-width: 110px;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .bkp-telegram-config-section {
        padding: 20px 15px;
    }
    
    .bkp-form-row .bkp-input {
        max-width: 100%;
    }
    
    .bkp-floating-message {
        right: 10px;
        left: 10px;
        top: 10px;
    }
    
    .bkp-toggle-monitor {
        padding: 5px 12px;
        font-size: 12px;
        min-width: 50px;
    }
}

/* ========================================
   OFFLINE HISTORY MODAL
   ======================================== */

.bkp-offline-history-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
}

.bkp-offline-history-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}

.bkp-offline-history-content {
    position: relative;
    margin: 4vh auto;
    width: 94%;
    max-width: 1050px;
    max-height: 92vh;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
}

.bkp-offline-history-header {
    padding: 16px 18px;
    background: linear-gradient(135deg, #111827 0%, #374151 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.bkp-oh-main-title {
    font-size: 18px;
    font-weight: 800;
    margin: 0;
}

.bkp-oh-sub-title {
    margin-top: 2px;
    font-size: 12px;
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70vw;
}

.bkp-oh-ip-strong {
    font-weight: 900;
    color: #fbbf24; /* highlight on dark header */
}

.bkp-offline-history-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 8px;
    transition: background 0.15s ease;
}

.bkp-offline-history-close:hover {
    background: rgba(255, 255, 255, 0.14);
}

.bkp-offline-history-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.bkp-oh-prev,
.bkp-oh-next {
    width: 38px;
    height: 34px;
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 800;
    color: #111827;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.bkp-oh-prev:hover,
.bkp-oh-next:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.bkp-oh-month-label {
    font-weight: 800;
    font-size: 14px;
    color: #111827;
}

.bkp-oh-spacer {
    flex: 1;
}

.bkp-oh-month-input {
    padding: 7px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    font-size: 14px;
}

.bkp-offline-history-body {
    display: flex;
    gap: 0;
    flex: 1;
    min-height: 0;
}

.bkp-oh-left {
    width: 48%;
    padding: 16px;
    border-right: 1px solid #e5e7eb;
    overflow: auto;
}

.bkp-oh-right {
    width: 52%;
    padding: 16px;
    overflow: auto;
}

.bkp-oh-loading {
    padding: 10px 12px;
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    margin-bottom: 12px;
    font-weight: 700;
}

.bkp-oh-calendar {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
}

.bkp-oh-calendar-weekdays,
.bkp-oh-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.bkp-oh-calendar-weekdays {
    background: #111827;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
}

.bkp-oh-weekday {
    padding: 10px 8px;
    text-align: center;
    border-right: 1px solid rgba(255, 255, 255, 0.12);
}
.bkp-oh-weekday:last-child {
    border-right: none;
}

.bkp-oh-day {
    min-height: 62px;
    padding: 10px 8px;
    border-right: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    position: relative;
    user-select: none;
}
.bkp-oh-day:nth-child(7n) {
    border-right: none;
}

.bkp-oh-day:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.06);
    z-index: 2;
}

.bkp-oh-day.is-outside {
    background: #f3f4f6;
    color: #9ca3af;
    cursor: default;
}

.bkp-oh-day.is-up {
    background: #dcfce7;
    color: #166534;
}

.bkp-oh-day.is-down {
    background: #fee2e2;
    color: #991b1b;
}

.bkp-oh-day.is-selected {
    outline: 3px solid rgba(59, 130, 246, 0.5);
    z-index: 3;
}

.bkp-oh-day-number {
    font-weight: 900;
    font-size: 14px;
}

.bkp-oh-day-badge {
    position: static;
    display: block;
    margin-top: 6px;
    font-size: 11px;
    font-weight: 900;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(17, 24, 39, 0.08);
    color: #111827;
    width: fit-content;
}

.bkp-oh-day-badge.offline-now {
    background: #dc2626;
    color: #fff;
    font-size: 9px;
    padding: 1px 6px;
    margin-top: 4px;
    line-height: 1;
    white-space: nowrap;
    letter-spacing: 0;
}

.bkp-oh-day-title {
    font-size: 16px;
    font-weight: 900;
    margin-bottom: 6px;
    color: #111827;
}

.bkp-oh-day-summary,
.bkp-oh-month-summary {
    color: #374151;
    font-size: 13px;
    margin-bottom: 10px;
}

.bkp-oh-timeline {
    margin: 12px 0 16px 0;
}

.bkp-oh-timeline-bar {
    position: relative;
    height: 18px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}

.bkp-oh-timeline-block {
    position: absolute;
    top: 0;
    height: 100%;
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
}

.bkp-oh-timeline-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #6b7280;
    margin-top: 6px;
}

.bkp-oh-sessions {
    border-top: 1px solid #e5e7eb;
    padding-top: 12px;
}

.bkp-oh-session {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    margin-bottom: 10px;
    background: #fff;
}

.bkp-oh-session-left {
    min-width: 0;
}

.bkp-oh-session-title {
    font-weight: 900;
    color: #111827;
    font-size: 13px;
}

.bkp-oh-session-sub {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}

.bkp-oh-session-right {
    font-weight: 900;
    color: #991b1b;
    font-size: 12px;
    white-space: nowrap;
}

@media (max-width: 900px) {
    .bkp-offline-history-body {
        flex-direction: column;
    }
    .bkp-oh-left,
    .bkp-oh-right {
        width: 100%;
        border-right: none;
    }
    .bkp-oh-left {
        border-bottom: 1px solid #e5e7eb;
    }
}

