/* Debug Functions - Tangerine Theme */

body {
    margin-bottom: 20px;
}

.debug-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */

.debug-container > h2 + p,
.debug-container > h2 + .alert + p {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 2.5rem;
}

/* Tabs */
body[data-theme="tangerine"] .debug-tabs {
    display: flex;
    gap: 4rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0;
}

body[data-theme="tangerine"] .debug-tab {
    padding: 1rem 0;
    width: 10%;
    background: none !important;
    border: none !important;
    color: #666 !important;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 0 !important;
    border-bottom: 3px solid transparent !important;
    margin-bottom: -1px;
    box-shadow: none !important;
}

body[data-theme="tangerine"] .debug-tab:hover {
    color: #999 !important;
    background: none !important;
    transform: none !important;
}

body[data-theme="tangerine"] .debug-tab.active {
    color: #ff6b35 !important;
    background: none !important;
    border-bottom: 3px solid #ff6b35 !important;
    box-shadow: none !important;
}

body[data-theme="tangerine"] .debug-tab-content {
    display: none;
}

body[data-theme="tangerine"] .debug-tab-content.active {
    display: block;
}

/* Grid Layout */
body[data-theme="tangerine"] .grid,
body[data-theme="tangerine"] .debug_items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
    gap: 1.5rem;
}

/* Cards */
.debug_item {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 16px !important;
    padding: 2rem !important;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    width: auto !important;
    margin: 0 !important;
}

.debug_item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #ff6b35, #f7931e);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.debug_item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15) !important;
    transform: translateY(-2px);
}

.debug_item:hover::before {
    opacity: 1;
}

/* Card headers with icons */
.debug_item h3 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem !important;
    font-size: 1.125rem !important;
    font-weight: 700 !important;
    color: #fff !important;
    border: none !important;
    padding-bottom: 0 !important;
}

/* .debug_item h3::before {
    content: '🗑️';
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
} */

/* Description text */
.debug_item .description,
.debug_item > p {
    color: #888;
    font-size: 0.875rem;
    line-height: 1.6;
    margin-bottom: 1.25rem;
}

/* Form Elements */
.form-group {
    margin-bottom: 1.25rem;
}

.label-items {
    padding: 15px;
    background-color: #45414145;
    border-radius: 8px;
}

.form-group label,
.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #888;
    margin-bottom: 0.5rem;
}

.form-input,
.form-select,
.debug-container input[type="text"],
.debug-container input[type="number"],
.debug-container select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #fff;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.form-input:focus,
.form-select:focus,
.debug-container input[type="text"]:focus,
.debug-container input[type="number"]:focus,
.debug-container select:focus {
    outline: none;
    border-color: #ff6b35;
    background: rgba(0, 0, 0, 0.5);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.form-input::placeholder {
    color: #555;
}

/* Checkboxes */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
}

.checkbox-group input[type="checkbox"],
.debug-container input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #ff6b35;
}

.checkbox-group label {
    color: #e0e0e0;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 0;
}

/* Radio Buttons */
.debug-container input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #ff6b35;
    margin-right: 8px;
}

#cleanup-upgrades-form .form-group label {
    display: flex;
    align-items: center;
    color: #e0e0e0;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 10px;
    padding: 0.5rem 0;
}

#cleanup-upgrades-form .form-group label:hover {
    color: #fff;
}

/* Buttons */
.btn,
.debug-container button,
.debug-container a.btn {
    width: 100%;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0.5rem;
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    color: #fff;
    text-align: center;
    text-decoration: none;
    display: inline-block;
}

.btn:hover,
.debug-container button:hover,
.debug-container a.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 107, 53, 0.4);
}

.button-group {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.button-group button {
    flex: 1;
}

/* Info/Warning Messages */
.info-text {
    background: rgba(255, 107, 53, 0.1);
    border: 1px solid rgba(255, 107, 53, 0.2);
    border-radius: 10px;
    padding: 1rem;
    font-size: 0.875rem;
    color: #ff6b35;
    margin-bottom: 1.25rem;
    line-height: 1.6;
}

.warning-text {
    background: rgba(255, 71, 87, 0.1);
    border: 1px solid rgba(255, 71, 87, 0.2);
    border-radius: 10px;
    padding: 1rem;
    font-size: 0.875rem;
    color: #ff4757;
    margin-bottom: 1.25rem;
    line-height: 1.6;
}

.debug-container .error {
    color: #ff4757;
    padding: 1rem;
    background: rgba(255, 71, 87, 0.1);
    border-radius: 10px;
    margin: 10px 0;
    border: 1px solid rgba(255, 71, 87, 0.2);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: #555;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    margin-bottom: 1rem;
}

/* Rate Limits */
.rate-limit-box {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.rate-limit-box:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 107, 53, 0.3);
}

.rate-limit-domain {
    font-size: 0.875rem;
    color: #888;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.rate-limit-stat {
    display: flex;
    justify-content: space-between;
    padding: 0.375rem 0;
    font-size: 0.85rem;
}

.rate-limit-label {
    color: #666;
}

.rate-limit-value {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
}

/* Queue Items */
.queue-items-container {
    margin-top: 20px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 10px;
    max-height: 300px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.02);
}

.queue-item {
    margin-bottom: 5px;
    display: flex;
    gap: 8px;
    padding: 0.2rem;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.queue-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.queue-item label {
    margin-left: 5px;
    color: #e0e0e0;
    cursor: pointer;
    margin-bottom: 0;
}

/* Verification Queue */
.verification-queue {
    width: 100%;
    max-width: 100%;
}

.verification-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    /* margin-bottom: 15px; */
    padding: 1rem;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}

.stats-item {
    display: flex;
    flex-direction: column;
    min-width: 120px;
}

.stats-label {
    font-size: 0.875rem;
    color: #888;
    font-weight: 600;
}

.stats-value {
    font-size: 1.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.verification-queue-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    background-color: rgba(255, 255, 255, 0.02);
    margin-top: 25px;
}

.verification-table {
    width: 100%;
    border-collapse: collapse;
}

.verification-table th,
.verification-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: #e0e0e0;
}

.verification-table th {
    background-color: rgba(255, 255, 255, 0.03);
    color: #fff;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.verification-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

.verification-table td {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


.token-status {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    /* padding: 1rem; */
    margin-bottom: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 4px solid transparent;
}

.token-status.valid {
    border-left-color: #ff6b35;
}

.token-status.invalid {
    border-left-color: #ff4757;
}

.token-user {
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #fff;
}

.token-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.9rem;
    background-color: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #e0e0e0;
}

.token-validity {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.875rem;
}

.token-validity.valid {
    background: rgba(255, 107, 53, 0.15);
    color: #ff6b35;
}

.token-validity.invalid {
    background: rgba(255, 71, 87, 0.15);
    color: #ff4757;
}

.token-expiry,
.token-last-refresh,
.token-access,
.token-refresh,
.token-username,
.token-last-checked {
    color: #ababab;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.token-access,
.token-refresh {
    font-family: 'Courier New', monospace;
    background-color: rgba(255, 255, 255, 0.03);
    padding: 0.5rem;
    border-radius: 6px;
    word-break: break-all;
    font-size: 0.8rem;
}

/* Cache Files */
.cache-files-container {
    margin-top: 15px;
    margin-bottom: 15px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 15px;
    overflow-y: auto;
    background-color: rgba(255, 255, 255, 0.02);
}

.cache-files-container h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
}

.cache-file-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.cache-file-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.cache-file-item input[type="checkbox"] {
    margin-right: 10px;
}

.cache-file-item label {
    color: #ccc;
    font-size: 0.9rem;
    word-break: break-all;
    margin-bottom: 0;
    flex-grow: 1;
    cursor: pointer;
}

/* Progress Area */
.progress-area {
    margin-top: 15px;
    padding: 1rem;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    min-height: 50px;
    max-height: 400px;
    overflow-y: auto;
}

.progress-area p {
    margin: 5px 0;
    color: #ddd;
}

.progress-area ul,
.results-area ul {
    margin-top: 5px;
    padding-left: 20px;
}

.progress-area li,
.results-area li {
    margin-bottom: 3px;
    color: #ccc;
}

/* Full-width card for monitoring */
.debug-card.full-width {
    grid-column: 1 / -1;
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 10px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    z-index: 1000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.success {
    background: #1a1a1a;
}

.toast.error {
    background: #1a1a1a;
}

.toast.info {
    background: #1a1a1a;
}

.toast.warning {
    background: #1a1a1a;
}

/* Plex Labels Help Button */
body[data-theme="tangerine"] .debug-container .plex-labels-help-btn {
    width: 6% !important;
    position: absolute;
    right: 0;
    top: 0;
    border: none;
    border-radius: 10px;
    padding: 4px 8px !important;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0.5rem;
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%) !important;
    color: #fff;
    text-align: center;
    text-decoration: none;
    display: inline-block;
}

body[data-theme="tangerine"] .debug-container .plex-labels-help-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255, 107, 53, 0.3);
}

body[data-theme="tangerine"] .debug-container .plex-labels-help-btn:active {
    transform: translateY(0);
}

/* Responsive */
@media (max-width: 768px) {
    .debug-container {
        padding: 1rem;
        width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    .debug-grid {
        grid-template-columns: 1fr;
    }

    body[data-theme="tangerine"] .debug-tabs {
        gap: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    body[data-theme="tangerine"] .debug-tabs::-webkit-scrollbar {
        display: none;
    }

    body[data-theme="tangerine"] .debug-tab {
        width: auto;
        flex-shrink: 0;
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }

    body[data-theme="tangerine"] .grid,
    body[data-theme="tangerine"] .debug_items {
        grid-template-columns: 1fr;
    }

    .debug_item {
        padding: 1.25rem !important;
    }

    .tab,
    .debug-tab {
        white-space: nowrap;
        font-size: 0.875rem;
        padding: 0.75rem 1rem;
    }

    .verification-queue {
        width: 100%;
    }

    .button-group {
        flex-direction: column;
    }

    .button-group button {
        width: 100%;
    }
}

/* Loading Overlay */
.loading {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

/* Loading overlay styles defined in base.css */

.loading-message {
    margin-bottom: 10px;
}

.loading-details {
    font-size: 14px;
    color: #ccc;
    margin-top: 10px;
}

.loading-progress-bar-container {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin-bottom: 15px;
    overflow: hidden;
}

.loading-progress-bar {
    height: 100%;
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    width: 0%;
    transition: width 0.3s ease;
}
