/* Compact Component Styling */

/* Clean navbar theme toggle button with subtle outline */
.navbar-theme-btn {
    background: transparent !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    color: rgba(255, 255, 255, 0.9) !important;
    transition: all 0.2s ease;
    border-radius: 0.25rem;
}

.navbar-theme-btn:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
    color: #ffffff !important;
    transform: none !important; /* Override the translateY from components.css */
}

.navbar-theme-btn:focus,
.navbar-theme-btn:active {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25) !important;
    outline: none !important;
    background: rgba(255, 255, 255, 0.15) !important;
}

/* Cards */
.card {
    background-color: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-color);
    transition: all 0.3s ease;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 0.4rem;
    margin-bottom: 1rem; /* Reduced spacing */
}

.card-body {
    padding: 1rem; /* Reduced from 1.25rem */
}

.card-header {
    padding: 0.6rem 1rem; /* Reduced padding */
    font-size: var(--base-font-size);
    font-weight: 600;
}

.card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* Compact Buttons */
.btn {
    padding: 0.4rem 0.8rem; /* Reduced from 0.5rem 1rem */
    font-size: 0.85rem;
    line-height: 1.3;
    border-radius: 0.3rem;
    transition: all 0.2s ease;
    font-weight: 500;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 0.6rem 1.2rem;
    font-size: 1rem;
}

.btn:hover {
    transform: translateY(-0.5px);
}

.btn:focus,
.btn:active {
    box-shadow: none !important;
    outline: none !important;
}

/* Compact Forms */
.form-control {
    padding: 0.4rem 0.7rem; /* Reduced padding */
    font-size: 0.85rem;
    line-height: 1.3;
    border-radius: 0.3rem;
    background-color: var(--input-bg);
    border-color: var(--input-border);
    color: var(--text-color);
    transition: all 0.2s ease;
}

.form-control:focus {
    background-color: var(--input-bg);
    border-color: #007bff;
    color: var(--text-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.form-select {
    background-color: var(--input-bg);
    border-color: var(--input-border);
    color: var(--text-color);
}

.form-group {
    margin-bottom: 0.8rem; /* Reduced from 1rem */
}

.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}


.table {
    font-size: 0.85rem;
}

.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Fixed column minimum widths for horizontal scrolling */
.config-permissions-table th:nth-child(1) { min-width: 150px; } /* Service */
.config-permissions-table th:nth-child(2) { min-width: 80px; }  /* Type */
.config-permissions-table th:nth-child(3) { min-width: 250px; } /* Target/URL */
.config-permissions-table th:nth-child(4) { min-width: 120px; } /* Groups */
.config-permissions-table th:nth-child(5) { min-width: 100px; } /* Interval */
.config-permissions-table th:nth-child(6) { min-width: 110px; } /* Managers */
.config-permissions-table th:nth-child(7) { min-width: 130px; } /* Actions */

/* Force table to use natural widths, not percentages */
.config-permissions-table {
    min-width: 1040px; /* Sum of all min-widths above */
    table-layout: auto; /* Let table size naturally */
}

/* Make table wide enough to trigger scrolling on smaller screens */
.config-permissions-table {
    min-width: 1000px; /* Force table to be wide enough */
}

/* Compact table rows */
.config-permissions-table td {
    vertical-align: middle;
    border-top: 1px solid #dee2e6;
    padding: 0.4rem; /* Reduced from 0.5rem for even more compact */
    line-height: 1.2;
}

.config-permissions-table th {
    padding: 0.6rem 0.4rem;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Make single-line entries */
.config-permissions-table .btn-group {
    white-space: nowrap;
}

.config-permissions-table .badge {
    margin-bottom: 0;
}

/* Better horizontal scrollbar */
.table-responsive::-webkit-scrollbar {
    height: 10px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 5px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 5px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #555;
}

[data-theme="dark"] .table-responsive::-webkit-scrollbar-track {
    background: #2d2d2d;
}

[data-theme="dark"] .table-responsive::-webkit-scrollbar-thumb {
    background: #666;
}

[data-theme="dark"] .table-responsive::-webkit-scrollbar-thumb:hover {
    background: #888;
}

/* Compact Badges */
.badge {
    padding: 0.2em 0.4em; /* Reduced padding */
    font-size: 0.7rem;
    border-radius: 0.25rem;
}

.badge-sm {
    font-size: 0.65rem;
    padding: 0.15em 0.3em;
}

/* Compact Alerts */
.alert {
    padding: 0.6rem 1rem; /* Reduced padding */
    margin-bottom: 0.8rem;
    font-size: 0.85rem;
    border-radius: 0.3rem;
}

/* Responsive search bar widths */
.input-group[style*="width: 250px"] {
    width: 250px !important; /* Default width */
}

@media (max-width: 1200px) {
    .input-group[style*="width: 250px"] {
        width: 200px !important;
    }
}

@media (max-width: 992px) {
    .input-group[style*="width: 250px"] {
        width: 180px !important;
    }
}

@media (max-width: 768px) {
    .input-group[style*="width: 250px"] {
        width: 150px !important;
    }
}

@media (max-width: 576px) {
    .input-group[style*="width: 250px"] {
        width: 120px !important;
    }
}

/* Also make sorting dropdown responsive */
.input-group[style*="width: 180px"] {
    width: 180px !important; /* Default sort dropdown */
}

@media (max-width: 992px) {
    .input-group[style*="width: 180px"] {
        width: 150px !important;
    }
}

@media (max-width: 768px) {
    .input-group[style*="width: 180px"] {
        width: 130px !important;
    }
}

@media (max-width: 576px) {
    .input-group[style*="width: 180px"] {
        width: 110px !important;
    }
}

/* Mobile responsive - allow horizontal scrolling instead of hiding columns */
@media (max-width: 768px) {
    .config-permissions-table {
        font-size: 0.8rem;
        min-width: 1200px; /* Force even wider on mobile to ensure scrolling */
    }
}


/* Dark mode table text colors */
[data-theme="dark"] .config-permissions-table td,
[data-theme="dark"] .config-permissions-table td strong,
[data-theme="dark"] .config-permissions-table td code {
    color: #ffffff !important;
}

[data-theme="dark"] .config-permissions-table td code {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Badge colors in dark mode */
[data-theme="dark"] .badge-outline-secondary {
    color: #ffffff;
    border-color: #6c757d;
}

/* Dark mode components */
[data-theme="dark"] .card {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
}

[data-theme="dark"] .card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .form-control {
    background-color: var(--input-bg);
    border-color: var(--input-border);
    color: var(--text-color);
}

[data-theme="dark"] .form-control:focus {
    background-color: var(--input-bg);
    border-color: var(--console-info);
    color: var(--text-color);
    box-shadow: 0 0 0 0.15rem rgba(33, 150, 243, 0.25);
}

[data-theme="dark"] .form-select {
    background-color: var(--input-bg);
    border-color: var(--input-border);
    color: var(--text-color);
}

[data-theme="dark"] .table td,
[data-theme="dark"] .table th {
    border-color: var(--border-color);
    color: var(--text-color);
}

/* FIXED: SOLID color alerts - no transparency! */
[data-theme="dark"] #test-alert.alert-success {
    background-color: #4caf50 !important; /* SOLID GREEN */
    border-color: #4caf50 !important;
    color: #ffffff !important;
    border-left: 4px solid #388e3c;
}

[data-theme="dark"] #test-alert.alert-danger {
    background-color: #f44336 !important; /* SOLID RED */
    border-color: #f44336 !important;
    color: #ffffff !important;
    border-left: 4px solid #d32f2f;
}

[data-theme="dark"] #test-alert.alert-warning {
    background-color: #ff9800 !important; /* SOLID ORANGE */
    border-color: #ff9800 !important;
    color: #ffffff !important;
    border-left: 4px solid #f57c00;
}

[data-theme="dark"] #test-alert strong {
    color: #ffffff !important;
}

[data-theme="dark"] #test-alert .btn-outline-light {
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.8) !important;
    background-color: rgba(255, 255, 255, 0.15) !important;
}

[data-theme="dark"] #test-alert .btn-outline-light:hover {
    background-color: rgba(255, 255, 255, 0.3) !important;
    border-color: #ffffff !important;
}

[data-theme="dark"] #test-alert .close {
    color: #ffffff !important;
    opacity: 0.9;
}

/* Keep vibrant info alerts in dark mode */
[data-theme="dark"] .alert-info {
    background-color: rgba(33, 150, 243, 0.15) !important;
    border-color: #2196f3 !important;
    color: #64b5f6 !important;
}

[data-theme="dark"] .alert-info strong {
    color: #90caf9 !important;
}

/* Keep vibrant admin stat cards in dark mode */
[data-theme="dark"] .card.bg-primary,
[data-theme="dark"] .admin-stat-card.bg-primary {
    background-color: #1976d2 !important;
    color: #ffffff !important;
}

[data-theme="dark"] .card.bg-success,
[data-theme="dark"] .admin-stat-card.bg-success {
    background-color: #388e3c !important;
    color: #ffffff !important;
}

[data-theme="dark"] .card.bg-info,
[data-theme="dark"] .admin-stat-card.bg-info {
    background-color: #0288d1 !important;
    color: #ffffff !important;
}

[data-theme="dark"] .card.bg-warning,
[data-theme="dark"] .admin-stat-card.bg-warning {
    background-color: #f57c00 !important;
    color: #ffffff !important;
}

[data-theme="dark"] .card.bg-danger,
[data-theme="dark"] .admin-stat-card.bg-danger {
    background-color: #d32f2f !important;
    color: #ffffff !important;
}

/* Also keep vibrant primary alerts */
[data-theme="dark"] .alert-primary {
    background-color: rgba(33, 150, 243, 0.15) !important;
    border-color: #2196f3 !important;
    color: #90caf9 !important;
}

/* Keep text in these cards white for contrast */
[data-theme="dark"] .bg-primary h3,
[data-theme="dark"] .bg-success h3,
[data-theme="dark"] .bg-info h3,
[data-theme="dark"] .bg-warning h3,
[data-theme="dark"] .bg-danger h3 {
    color: #ffffff !important;
}

[data-theme="dark"] .bg-primary p,
[data-theme="dark"] .bg-success p,
[data-theme="dark"] .bg-info p,
[data-theme="dark"] .bg-warning p,
[data-theme="dark"] .bg-danger p {
    color: rgba(255, 255, 255, 0.9) !important;
}

/* Vibrant dark mode badges */
[data-theme="dark"] .badge-primary { 
    background-color: #2196f3; 
    color: #ffffff; 
}

[data-theme="dark"] .badge-success { 
    background-color: #4caf50; 
    color: #ffffff; 
}

[data-theme="dark"] .badge-danger { 
    background-color: #f44336; 
    color: #ffffff; 
}

[data-theme="dark"] .badge-warning { 
    background-color: #ff9800; 
    color: #ffffff; 
}

[data-theme="dark"] .badge-info { 
    background-color: #00bcd4; 
    color: #ffffff; 
}

/* Button group focus fixes */
.btn-group .btn:focus,
.btn-group .btn:active,
.btn-outline-secondary:focus,
.btn-outline-secondary:active {
    box-shadow: none !important;
    outline: none !important;
}

/* Dark mode buttons */
[data-theme="dark"] .btn-outline-secondary {
    color: var(--console-secondary);
    border-color: var(--console-secondary);
}

[data-theme="dark"] .btn-outline-secondary:hover {
    background-color: var(--console-secondary);
    color: #1a1a1a;
}

/* Modal dark mode support */
[data-theme="dark"] .modal-content {
    background-color: #2d3748;
    color: #ffffff;
}

[data-theme="dark"] .modal-header {
    border-bottom-color: #4a5568;
}

[data-theme="dark"] .modal-footer {
    border-top-color: #4a5568;
}

[data-theme="dark"] .managers-table th,
[data-theme="dark"] .managers-table td {
    color: #ffffff;
    border-color: #4a5568;
}

[data-theme="dark"] .close {
    color: #ffffff;
    opacity: 0.8;
}

/* Dropdown dark mode */
[data-theme="dark"] .dropdown-menu {
    background-color: var(--card-bg);
    border-color: var(--border-color);
}

[data-theme="dark"] .dropdown-item {
    color: var(--text-color);
}

[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus {
    background-color: #404040;
    color: var(--text-color);
}

/* Light mode test results */
.test-result-default {
    background-color: #d1ecf1 !important;
    border-color: #bee5eb !important;
    color: #0c5460 !important;
    border-left: 4px solid #17a2b8 !important;
}

.test-result-success {
    background-color: #d4edda !important;
    border-color: #c3e6cb !important;
    color: #155724 !important;
    border-left: 4px solid #28a745 !important;
}

.test-result-warning {
    background-color: #fff3cd !important;
    border-color: #ffeaa7 !important;
    color: #856404 !important;
    border-left: 4px solid #ffc107 !important;
}

.test-result-error {
    background-color: #f8d7da !important;
    border-color: #f5c6cb !important;
    color: #721c24 !important;
    border-left: 4px solid #dc3545 !important;
}

/* Dark mode test results */
[data-theme="dark"] .test-result-default {
    background-color: #1a1a1a !important;
    border-color: #404040 !important;
    color: #e0e0e0 !important;
    border-left: 4px solid #17a2b8 !important;
}

[data-theme="dark"] .test-result-success {
    background-color: #4caf50 !important;
    border-color: #4caf50 !important;
    color: #ffffff !important;
    border-left: 4px solid #388e3c !important;
}

[data-theme="dark"] .test-result-warning {
    background-color: #ff9800 !important;
    border-color: #ff9800 !important;
    color: #ffffff !important;
    border-left: 4px solid #f57c00 !important;
}

[data-theme="dark"] .test-result-error {
    background-color: #f44336 !important;
    border-color: #f44336 !important;
    color: #ffffff !important;
    border-left: 4px solid #d32f2f !important;
}

[data-theme="dark"] #selector-test-output {
    color: inherit !important;
    font-family: 'Courier New', monospace !important;
}

[data-theme="dark"] #selector-test-result label {
    color: #ffffff !important;
}