/**
 * Debug Log Premium Styles
 * 
 * @package WPIKO_Chatbot
 */

/* Main Container */
.wpiko-debug-log-container {
    max-width: 1200px;
}

/* Match .responses-api-section styles from AI Config */
.wpiko-debug-log-container .wpiko-card {
    background: #fff;
    padding: 20px;
    margin-top: 0;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(58, 79, 102, 0.08);
    /* Exact match */
    border: none;
    overflow: hidden;
}

/* Header Section - Simplified to match AI Configuration */
.wpiko-debug-log-container .wpiko-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* Header Toggle */
.debug-logging-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f0f4ff;
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid #e1e8ff;
    box-sizing: border-box;
    /* Fix for mobile width */
}

.wpiko-debug-log-container .toggle-status-label {
    font-size: 13px;
    font-weight: 600;
    color: #0968fe;
}

.wpiko-debug-log-container .toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.wpiko-debug-log-container .toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.wpiko-debug-log-container .toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: 0.3s;
    border-radius: 24px;
}

.wpiko-debug-log-container .toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.wpiko-debug-log-container .toggle-switch input:checked+.toggle-slider {
    background-color: #0968fe;
}

.wpiko-debug-log-container .toggle-switch input:checked+.toggle-slider:before {
    transform: translateX(20px);
}

.wpiko-debug-log-container .toggle-switch input:focus+.toggle-slider {
    box-shadow: 0 0 0 2px rgba(9, 104, 254, 0.2);
}

/* Stats Grid */
.wpiko-debug-log-container .log-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
    /* Removed background and border to sit cleanly on white card */
}

.wpiko-debug-log-container .stat-card {
    background: #fff;
    border: 1px solid #e2e4e7;
    border-radius: 10px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.2s ease;
}

.wpiko-debug-log-container .stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border-color: #bdc3c7;
}

.wpiko-debug-log-container .stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.wpiko-debug-log-container .stat-icon .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.wpiko-debug-log-container .stat-content {
    display: flex;
    flex-direction: column;
}

.wpiko-debug-log-container .stat-number {
    font-size: 20px;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1.2;
}

.wpiko-debug-log-container .stat-label {
    font-size: 12px;
    color: #646970;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* Stat Variants */
.wpiko-debug-log-container .stat-card .icon-total {
    background: #0968fe;
    color: #ffffff;
}

.wpiko-debug-log-container .stat-card .icon-info {
    background: #0284c7;
    color: #ffffff;
}

.wpiko-debug-log-container .stat-card.stat-warning .icon-warning {
    background: #d97706;
    color: #ffffff;
}

.wpiko-debug-log-container .stat-card.stat-error .icon-error {
    background: #dc3545;
    color: #ffffff;
}

.wpiko-debug-log-container .stat-card.stat-warning .stat-number {
    color: #d97706;
}

.wpiko-debug-log-container .stat-card.stat-error .stat-number {
    color: #dc2626;
}


/* Toolbar */
.log-toolbar {
    padding: 0 0 16px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* Removed border and background as it floats within the main container */
}

.log-filter-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.log-filter-wrapper .dashicons {
    position: absolute;
    left: 10px;
    color: #646970;
    z-index: 1;
    pointer-events: none;
}

.wpiko-debug-log-container .log-filter {
    padding-left: 32px !important;
    min-width: 160px;
    border-radius: 6px !important;
    border-color: #dcdcde !important;
    height: 36px !important;
    color: #3c434a !important;
    transition: all 0.2s ease;
}

.wpiko-debug-log-container .log-filter:focus {
    border-color: #0968fe !important;
    box-shadow: 0 0 0 2px rgba(9, 104, 254, 0.1) !important;
    outline: none !important;
    color: #333 !important;
}

.log-actions-right {
    display: flex;
    gap: 8px;
}

.log-actions-right .button {
    height: 36px !important;
    line-height: 34px !important;
    border-radius: 6px !important;
}

.wpiko-debug-log-container .button.icon-button {
    padding: 0 10px !important;
    min-width: 36px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
}

.wpiko-debug-log-container .button-link-delete {
    color: #dc2626 !important;
    border-color: #fca5a5 !important;
    background: #fff !important;
    transition: all 0.2s;
}

.wpiko-debug-log-container .button-link-delete:hover {
    background: #fef2f2 !important;
    border-color: #dc2626 !important;
    color: #b91c1c !important;
}

.wpiko-debug-log-container .button-link-delete .dashicons {
    margin-right: 4px;
}


/* Log Viewer */
.log-viewer-container {
    max-height: 500px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 6px;
}

.log-viewer {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
}

.log-viewer thead th {
    position: sticky;
    top: 0;
    background: #f8f9fa;
    color: #3c434a;
    font-weight: 600;
    text-align: left;
    padding: 12px 24px;
    font-size: 13px;
    border-bottom: 1px solid #e2e4e7;
    z-index: 10;
}

.log-viewer tbody td {
    padding: 12px 24px;
    border-bottom: 1px solid #f0f0f1;
    vertical-align: top;
    font-size: 13px;
    color: #3c434a;
}

.log-viewer tbody tr:last-child td {
    border-bottom: none;
}

.log-viewer tbody tr:hover {
    background-color: #f8faff;
}

/* Columns */
.log-col-time {
    width: 160px;
    white-space: nowrap;
}

.log-col-level {
    width: 100px;
}

.log-col-message {
    width: auto;
}

.log-timestamp {
    font-family: 'Menlo', 'Monaco', monospace;
    color: #646970;
    font-size: 12px;
}

.log-message-content {
    font-family: 'Menlo', 'Monaco', monospace;
    white-space: pre-wrap;
    word-break: break-all;
    font-size: 12px;
    line-height: 1.5;
}

/* Badges */
.log-level-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    min-width: 60px;
}

.wpiko-debug-log-container .log-level-badge.level-info {
    background: #e0f2fe;
    color: #0284c7;
}

.wpiko-debug-log-container .log-level-badge.level-warning {
    background: #fffbeb;
    color: #d97706;
}

.wpiko-debug-log-container .log-level-badge.level-error {
    background: #fef2f2;
    color: #dc2626;
}

/* States */
.no-logs td {
    padding: 60px 20px !important;
    text-align: center;
    background: #fff;
}

.no-logs-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.no-logs-icon {
    width: 64px;
    height: 64px;
    background: #f0f4ff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.no-logs-icon .dashicons {
    font-size: 32px;
    width: 32px;
    height: 32px;
    color: #0968fe;
}

.no-logs-message {
    font-size: 16px;
    font-weight: 500;
    color: #3c434a;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.no-logs-message span {
    font-size: 13px;
    font-weight: 400;
    color: #8c8f94;
}

/* Footer & Note */
.wpiko-debug-log-container .wpiko-card-footer {
    padding: 16px 0 0 0;
    background: transparent;
    border-top: 1px solid #EFF2F6;
    margin-top: 16px;
    font-size: 13px;
    color: #646970;
}

.wpiko-debug-log-container .wpiko-card-footer p {
    margin: 0;
}

/* Responsive */
@media (max-width: 782px) {
    .wpiko-debug-log-container .wpiko-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .debug-logging-toggle-wrapper {
        width: 100%;
        justify-content: space-between;
    }

    .wpiko-debug-log-container .log-stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .wpiko-debug-log-container .log-toolbar {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }

    .wpiko-debug-log-container .log-filter {
        width: 100%;
    }

    .wpiko-debug-log-container .log-actions-right {
        justify-content: flex-start;
        gap: 12px;
    }
}