/* AB Test Management System - Modern Minimal Design */

* {
    font-family: 'Poppins', sans-serif;
    box-sizing: border-box;
}

:root {
    --primary: #000;
    --primary-hover: #333;
    --border: #e0e0e0;
    --bg-light: #fafafa;
    --text-muted: #6c757d;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #17a2b8;
}

body {
    background: #ffffff;
    color: #212529;
    min-height: 100vh;
    line-height: 1.6;
}

/* Navigation */
.navbar {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.75rem 0;
}

.navbar-dark .navbar-brand {
    font-weight: 600;
    font-size: 1.1rem;
    color: #fff !important;
}

.navbar-dark .nav-link {
    color: rgba(255, 255, 255, 0.75) !important;
    font-weight: 400;
    transition: color 0.2s;
}

.navbar-dark .nav-link:hover {
    color: #fff !important;
}

.navbar-light .navbar-brand {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--primary) !important;
}

.navbar-light .nav-link {
    color: #495057 !important;
    font-weight: 400;
    transition: color 0.2s;
}

.navbar-light .nav-link:hover {
    color: var(--primary) !important;
}

/* Cards */
.card {
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-bottom: 1.5rem;
    background: #fff;
}

.card-header {
    background: #f8f9fa;
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.25rem;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--primary);
}

.card-body {
    padding: 1.25rem;
}

/* Buttons */
.btn {
    border-radius: 6px;
    font-weight: 500;
    padding: 0.5rem 1.25rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.btn-dark {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.btn-dark:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-outline-dark {
    border-color: var(--border);
    color: var(--primary);
    background: #fff;
}

.btn-outline-dark:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

/* Forms */
.form-control, .form-select {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    transition: all 0.2s;
    background: #fff;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
    outline: none;
}

.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    color: #495057;
}

/* Bootstrap Select styling to match form-select */
.bootstrap-select {
    width: 100% !important;
}

.bootstrap-select .dropdown-toggle {
    display: block;
    width: 100%;
    padding: 0.5rem 2.25rem 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: all 0.2s;
}

.bootstrap-select .dropdown-toggle:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.bootstrap-select .dropdown-toggle:hover {
    border-color: var(--primary);
}

.bootstrap-select.form-select {
    padding: 0;
    border: none;
    background: none;
}

.bootstrap-select > .dropdown-toggle {
    width: 100%;
}

.bootstrap-select.btn-group .dropdown-toggle .filter-option {
    text-align: left;
    padding: 0;
}

.bootstrap-select.btn-group .dropdown-toggle .filter-option-inner {
    padding: 0;
}

.bootstrap-select .dropdown-menu {
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.bootstrap-select .dropdown-menu .dropdown-item {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

.bootstrap-select .dropdown-menu .dropdown-item:hover {
    background-color: #f8f9fa;
}

.bootstrap-select .dropdown-menu .dropdown-item.active {
    background-color: var(--primary);
    color: #fff;
}

/* Tables */
.table {
    margin-bottom: 0;
    font-size: 0.875rem;
}

.table thead th {
    border-bottom: 2px solid var(--border);
    font-weight: 600;
    color: var(--primary);
    padding: 0.75rem;
    background: #f8f9fa;
}

.table tbody td {
    padding: 0.75rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
}

.table tbody td:first-child {
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.table tbody td:first-child strong {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.table-bordered {
    border: 1px solid var(--border);
}

.table-bordered thead th {
    border: 1px solid var(--border);
}

.table-bordered tbody td {
    border: 1px solid var(--border);
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
    font-size: 0.75rem;
    border-radius: 4px;
}

/* Alerts */
.alert {
    border-radius: 6px;
    border: none;
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
}

/* Timeline - Modern Advanced Design */
#timeline-container {
    position: relative;
    padding-left: 0;
}

.timeline-item {
    padding-bottom: 0.75rem;
    position: relative;
    padding-left: 2.75rem;
    transition: all 0.3s ease;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-item:hover {
    transform: translateX(3px);
}

/* Vertical connecting line */
.timeline-item::before {
    content: '';
    position: absolute;
    left: 13px;
    top: 30px;
    bottom: -0.75rem;
    width: 2px;
    background: linear-gradient(to bottom, var(--border), transparent);
    z-index: 0;
}

.timeline-item:last-child::before {
    display: none;
}

.timeline-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 2px solid #fff;
    transition: all 0.3s ease;
    z-index: 2;
    background: var(--primary);
    vertical-align: middle;
}

.timeline-item:hover .timeline-icon {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.timeline-icon i {
    font-size: 0.9rem;
}

.timeline-content {
    background: #fff;
    border-radius: 5px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    transition: all 0.3s ease;
}

.timeline-item:hover .timeline-content {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
    border-color: var(--primary);
}

.timeline-header {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.timeline-header .timeline-icon {
    position: relative;
    left: auto;
    top: auto;
    flex-shrink: 0;
}

.timeline-description {
    flex: 1;
    line-height: 1.3;
}

.timeline-item strong {
    font-size: 0.8rem;
    color: var(--primary);
    display: inline;
    line-height: 1.3;
    font-weight: 600;
}

.timeline-meta {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    padding-top: 0.25rem;
    border-top: 1px solid var(--bg-light);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.timeline-meta i {
    font-size: 0.6rem;
}

/* Change highlights */
.timeline-change {
    display: inline-block;
    padding: 0.1rem 0.25rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    margin: 0 0.08rem;
}

.timeline-change-old {
    background: #fee;
    color: #c33;
    text-decoration: line-through;
}

.timeline-change-new {
    background: #efe;
    color: #3c3;
}

.timeline-change-arrow {
    color: var(--text-muted);
    margin: 0 0.08rem;
    font-weight: normal;
    font-size: 0.75rem;
}

.timeline-item.timeline-created .timeline-icon {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%) !important;
}

.timeline-item.timeline-started .timeline-icon {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%) !important;
}

.timeline-item.timeline-updated .timeline-icon {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%) !important;
}

.timeline-item.timeline-stopped .timeline-icon {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%) !important;
}

.timeline-item.timeline-winner .timeline-icon {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%) !important;
    color: #000;
}

.timeline-item.timeline-paused .timeline-icon {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%) !important;
    color: #000;
}

/* Comment badge */
.timeline-comment-badge {
    display: inline-block;
    margin-top: 0.25rem;
    padding: 0.4rem 0.6rem;
    background: var(--bg-light);
    border-left: 2px solid var(--primary);
    border-radius: 3px;
    font-size: 0.75rem;
    color: #495057;
    width: 100%;
    line-height: 1.3;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Button Loading State */
.btn.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Compact Layout */
.container-fluid {
    padding-left: 1rem;
    padding-right: 1rem;
}

.py-4 {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
}

.mb-4 {
    margin-bottom: 1.5rem !important;
}

.mb-3 {
    margin-bottom: 1rem !important;
}

.mb-2 {
    margin-bottom: 0.75rem !important;
}

/* Nav Tabs */
.nav-tabs {
    border-bottom: 2px solid var(--border);
}

.nav-tabs .nav-link {
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    padding: 0.75rem 1rem;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-tabs .nav-link:hover {
    border-bottom-color: var(--border);
    color: var(--primary);
}

.nav-tabs .nav-link.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: transparent;
}

/* Login Page */
.login-page {
    background: #fff;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-page .card {
    max-width: 420px;
    width: 100%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.login-page .card-header {
    background: var(--primary);
    color: #fff;
    border: none;
    text-align: center;
    padding: 1.5rem;
}

.login-page .card-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

/* Metric Cards */
.metric-card {
    transition: transform 0.2s;
}

.metric-card:hover {
    transform: translateY(-2px);
}

/* Variant Winner */
.variant-winner {
    border: 2px solid var(--success) !important;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* Utility Classes */
.text-muted {
    color: var(--text-muted) !important;
}

.bg-light {
    background-color: var(--bg-light) !important;
}

/* Comments Section */
.comments-section {
    background: var(--bg-light);
    border-radius: 6px;
    padding: 1rem;
    margin-top: 1rem;
}

.comment-item {
    padding: 0.75rem;
    background: #fff;
    border-radius: 6px;
    margin-bottom: 0.75rem;
    border-left: 3px solid var(--primary);
}

.comment-item:last-child {
    margin-bottom: 0;
}

.comment-header {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.comment-text {
    font-size: 0.875rem;
    color: #495057;
    margin: 0;
}

/* Compact Forms */
.form-row-compact .form-group {
    margin-bottom: 0.75rem;
}

/* Status Badges */
.badge.bg-success {
    background-color: var(--success) !important;
}

.badge.bg-warning {
    background-color: var(--warning) !important;
    color: #000;
}

.badge.bg-danger {
    background-color: var(--danger) !important;
}

.badge.bg-secondary {
    background-color: #6c757d !important;
}

.badge.bg-info {
    background-color: var(--info) !important;
}

/* Search Highlighting */
mark {
    background-color: #fff3cd;
    padding: 0.1em 0.2em;
    border-radius: 3px;
    font-weight: 500;
}

/* Inline Editing */
.inline-edit-field {
    position: relative;
    transition: all 0.2s ease;
}

.inline-edit-field:hover {
    background-color: #f8f9fa;
}

.inline-edit-field:hover .bi-pencil-square {
    opacity: 0.7 !important;
}

.inline-edit-input,
.inline-edit-textarea,
.inline-edit-select {
    border: 1px solid var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.inline-edit-textarea {
    resize: vertical;
    min-height: 80px;
}

.inline-edit-field .bi-pencil-square {
    transition: opacity 0.2s;
    pointer-events: none;
}

.inline-edit-field.editing {
    background-color: #f8f9fa;
    border-radius: 4px;
}

.inline-edit-field.editing .bi-pencil-square {
    opacity: 0.3;
}
