/* UniBrix Custom Styles - Modern UI */

/* === Custom Button Styles === */
.btn {
    border-radius: 0.5rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
    border: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, #06b6d4 0%, #22d3ee 100%);
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0891b2 0%, #06b6d4 100%);
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.4);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
    color: #fff;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
    transform: translateY(-1px);
    color: #fff;
}

.btn-secondary {
    background: linear-gradient(135deg, #6b7280 0%, #9ca3af 100%);
    box-shadow: 0 2px 8px rgba(107, 114, 128, 0.3);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #4b5563 0%, #6b7280 100%);
    box-shadow: 0 4px 12px rgba(107, 114, 128, 0.4);
    transform: translateY(-1px);
}

.btn-outline-primary {
    border: 2px solid #06b6d4;
    color: #06b6d4;
    background: transparent;
}

.btn-outline-primary:hover {
    background: #06b6d4;
    color: white;
    border-color: #06b6d4;
}

.btn-outline-danger {
    border: 2px solid #ef4444;
    color: #ef4444;
    background: transparent;
}

.btn-outline-danger:hover {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
}

.btn-outline-light {
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.9);
    background: transparent;
}

.btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    border-radius: 0.375rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* === Custom Pagination === */
.pagination {
    gap: 0.375rem;
}

.pagination .page-item {
    margin: 0;
}

.pagination .page-link {
    border: none;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    min-width: 40px;
    text-align: center;
    color: var(--text-primary);
    background-color: var(--bg-card);
    transition: all 0.2s ease;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.pagination .page-link:hover {
    background: linear-gradient(135deg, #06b6d4 0%, #22d3ee 100%);
    color: white;
    box-shadow: 0 4px 8px rgba(6, 182, 212, 0.3);
}

.pagination .page-item.active .page-link {
    background: linear-gradient(135deg, #06b6d4 0%, #22d3ee 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.4);
}

.pagination .page-item.disabled .page-link {
    opacity: 0.4;
    cursor: not-allowed;
    background-color: var(--bg-card);
    color: var(--text-secondary);
}

.pagination .page-item.disabled .page-link:hover {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    background-color: var(--bg-card);
}

/* === Custom Table Styles === */
.table {
    border-radius: 0.75rem;
    overflow: hidden;
}

.table thead th {
    background: #f8f9fa;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    padding: 1rem;
    border: none;
}

.table thead th i {
    color: #6c757d;
}

[data-theme="dark"] .table thead th {
    background: #2d333b;
}

[data-theme="dark"] .table thead th i {
    color: rgba(255, 255, 255, 0.7);
}

.table tbody tr {
    transition: background-color 0.2s ease;
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr:hover {
    background-color: var(--table-hover);
}

.table tbody td {
    padding: 1rem;
    vertical-align: middle;
}

/* === Custom Form Controls === */
.form-control, .form-select {
    border-radius: 0.5rem;
    border: 2px solid var(--input-border);
    padding: 0.625rem 0.875rem;
    transition: all 0.2s ease;
    background-color: var(--input-bg);
    color: var(--text-primary);
}

.form-control::placeholder {
    color: var(--bs-secondary-color);
    opacity: 0.7;
}

[data-theme="dark"] .form-control::placeholder,
[data-theme="dark"] .form-select::placeholder {
    color: rgba(255, 255, 255, 0.5);
    opacity: 1;
}

.form-control:focus, .form-select:focus {
    border-color: #06b6d4;
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
    outline: none;
}

.form-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

/* === Custom Badge Styles === */
.badge {
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.025em;
    text-transform: uppercase;
}

.bg-primary {
    background: linear-gradient(135deg, #06b6d4 0%, #22d3ee 100%) !important;
}

.badge.bg-primary {
    background: linear-gradient(135deg, #06b6d4 0%, #22d3ee 100%) !important;
}

.bg-success {
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%) !important;
}

.bg-danger {
    background: linear-gradient(135deg, #ef4444 0%, #f87171 100%) !important;
}

.bg-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%) !important;
}

.bg-info {
    background: linear-gradient(135deg, #06b6d4 0%, #22d3ee 100%) !important;
}

.bg-secondary {
    background: linear-gradient(135deg, #6b7280 0%, #9ca3af 100%) !important;
}

.bg-dark {
    background: linear-gradient(135deg, #374151 0%, #4b5563 100%) !important;
}

/* === Custom Card Styles === */
.card {
    border-radius: 1rem;
    border: 1px solid var(--border-color);
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.card-header {
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    font-weight: 600;
    border-radius: 1rem 1rem 0 0;
}

[data-theme="dark"] .card-header {
    background: linear-gradient(135deg, #374151 0%, #4b5563 100%);
}

/* === Custom Alert Styles === */
.alert {
    border-radius: 0.75rem;
    border: none;
    padding: 1rem 1.25rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.alert-danger {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
}

[data-theme="dark"] .alert-danger {
    background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 100%);
    color: #fecaca;
}

/* === Custom Modal Styles === */
.modal-content {
    border-radius: 1rem;
    border: none;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    border-radius: 1rem 1rem 0 0;
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-radius: 0 0 1rem 1rem;
}

/* === Loading Spinner === */
.spinner-border {
    width: 1.25rem;
    height: 1.25rem;
    border-width: 0.15em;
}

/* === Custom Stat Card === */
.stat-card .stat-icon {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.1) 0%, rgba(34, 211, 238, 0.2) 100%);
    border: 2px solid rgba(6, 182, 212, 0.2);
}

.stat-card:hover {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

/* === Dropdown Menu === */
.dropdown-menu {
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    padding: 0.5rem;
}

.dropdown-item {
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background-color: var(--table-hover);
}

/* === Smooth Transitions === */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

button, a, .page-link, .btn {
    transition: all 0.2s ease !important;
}

/* === Bootstrap Active State Overrides === */
.list-group-item.active {
    background-color: #06b6d4 !important;
    border-color: #06b6d4 !important;
}

.list-group-item-action:hover {
    background-color: #e0f2fe !important;
}

.list-group-item-action:active {
    background-color: #bae6fd !important;
}

[data-theme="dark"] .list-group-item-action:hover {
    background-color: #1e3a4a !important;
}

[data-theme="dark"] .list-group-item-action:active {
    background-color: #164e63 !important;
}

.nav-pills .nav-link.active {
    background-color: #06b6d4 !important;
    border-color: #06b6d4 !important;
}

.btn-check:checked + .btn-outline-primary {
    background-color: #06b6d4 !important;
    border-color: #06b6d4 !important;
}

/* === Log Viewer Styles === */
.log-viewer {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 1.5rem;
    border-radius: 0.5rem;
    max-height: 75vh;
    overflow: auto;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
}

.log-line {
    padding: 3px 8px;
    border-left: 3px solid transparent;
    padding-left: 12px;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-all;
}

.log-match {
    background-color: rgba(255, 193, 7, 0.15);
    border-left-color: #ffc107;
}

.search-highlight {
    background-color: #ffc107;
    color: #000;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: bold;
}

.log-error {
    background-color: rgba(239, 68, 68, 0.1);
    border-left-color: #ef4444;
    color: #fca5a5;
}

.log-warn {
    background-color: rgba(245, 158, 11, 0.1);
    border-left-color: #f59e0b;
    color: #fcd34d;
}

.log-info {
    background-color: rgba(59, 130, 246, 0.05);
    border-left-color: #3b82f6;
    color: #93c5fd;
}

.log-debug {
    color: #9ca3af;
}

.search-result-item {
    transition: all 0.2s ease;
}

.search-result-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* === Dark Mode Specific Fixes === */
[data-theme="dark"] .nav-link {
    color: rgba(255, 255, 255, 0.75) !important;
}

[data-theme="dark"] .nav-link:hover {
    color: rgba(255, 255, 255, 0.95) !important;
}

[data-theme="dark"] .nav-link.active {
    color: #fff !important;
}

[data-theme="dark"] .nav-tabs .nav-link {
    color: rgba(255, 255, 255, 0.65) !important;
}

[data-theme="dark"] .nav-tabs .nav-link:hover {
    color: rgba(255, 255, 255, 0.85) !important;
}

[data-theme="dark"] .nav-tabs .nav-link.active {
    color: #fff !important;
    background-color: var(--bs-body-bg) !important;
}

[data-theme="dark"] .card-body {
    color: rgba(255, 255, 255, 0.85);
}

[data-theme="dark"] .card-text {
    color: rgba(255, 255, 255, 0.85) !important;
}

[data-theme="dark"] .text-muted {
    color: rgba(255, 255, 255, 0.5) !important;
}

[data-theme="dark"] .bi {
    color: inherit !important;
}

[data-theme="dark"] h1, 
[data-theme="dark"] h2, 
[data-theme="dark"] h3, 
[data-theme="dark"] h4, 
[data-theme="dark"] h5, 
[data-theme="dark"] h6 {
    color: rgba(255, 255, 255, 0.95);
}

[data-theme="dark"] label {
    color: rgba(255, 255, 255, 0.85);
}

[data-theme="dark"] .small,
[data-theme="dark"] small {
    color: rgba(255, 255, 255, 0.6);
}

/* Fix bg-body class in dark mode */
[data-theme="dark"] .bg-body {
    background-color: #212529 !important;
}

/* AI Chat message bubbles */
.ai-message-bg {
    background-color: #f8f9fa;
    color: #212529;
}

[data-theme="dark"] .ai-message-bg {
    background-color: #2d333b;
    color: #e6edf3;
}

.ai-code-bg {
    background-color: #f8f9fa;
    color: #212529;
}

[data-theme="dark"] .ai-code-bg {
    background-color: #1a1d23;
    color: #e6edf3;
    border: 1px solid #30363d;
}

/* Dark mode form controls - disabled state */
[data-theme="dark"] .form-control:disabled {
    background-color: #2d333b;
    color: rgba(255, 255, 255, 0.5);
    border-color: #444c56;
}

/* Dark mode btn-outline-dark fix */
[data-theme="dark"] .btn-outline-dark {
    --bs-btn-color: #e6edf3;
    --bs-btn-border-color: #8b949e;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #6b7280;
    --bs-btn-hover-border-color: #6b7280;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #6b7280;
    --bs-btn-active-border-color: #6b7280;
    --bs-btn-disabled-color: #8b949e;
    --bs-btn-disabled-border-color: #8b949e;
}

/* === Utility Classes === */
.cursor-pointer {
    cursor: pointer;
}

.user-select-none {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}
