/* BalloonGrid Custom Styles */
:root {
    --bg-primary: #4a90e2;
    --bg-success: #7ed321;
    --bg-warning: #f5a623;
    --bg-info: #50e3c2;
    --bg-secondary: #9013fe;
    --balloon-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --balloon-hover-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* Zoom settings - default to overview */
    --slot-height: 15px;
}

/* Fix white text on white background issues */
.card-body .text-white,
.bg-light .text-white,
.bg-white .text-white {
    color: #333 !important;
}

/* Navbar brand and account info fixes */
.navbar-brand {
    color: #333 !important;
}

.navbar-text {
    color: #333 !important;
}

.navbar-text .text-white {
    color: #333 !important;
}

/* Badge text fixes */
.badge.text-white {
    color: white !important;
}

/* General white text on light backgrounds */
.card .text-white,
.bg-light .text-white {
    color: #333 !important;
}

/* Fix dashboard card text specifically */
.card-body p.text-muted,
.card-body .text-muted {
    color: #6c757d !important;
}

.grid-card .card-body * {
    color: #333 !important;
}

.grid-card .badge {
    color: white !important;
}

/* Global Styles - Light Theme */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f8f9fa;
    min-height: 100vh;
    color: #333;
}

.container-fluid {
    max-width: 1400px;
}

/* Custom Button Styles */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: var(--transition-smooth);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Card Enhancements */
.card {
    border-radius: 12px;
    border: none;
    box-shadow: var(--balloon-shadow);
    transition: var(--transition-smooth);
}

.card:hover {
    box-shadow: var(--balloon-hover-shadow);
    transform: translateY(-2px);
}

.grid-card {
    transition: var(--transition-smooth);
}

.grid-card:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* Kanban Styles */
.days-container {
    padding-bottom: 2rem;
}

.day-section {
    margin-bottom: 3rem;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--balloon-shadow);
}

.day-header {
    background: linear-gradient(135deg, var(--bg-primary), #357abd);
    padding: 1.5rem;
    border-radius: 12px 12px 0 0;
}

.day-grid {
    background: #f8f9fa;
    min-height: 400px;
    border-radius: 0 0 12px 12px;
}

.time-slots {
    display: flex;
    flex-direction: column;
    background: #dee2e6;
    min-height: 400px;
}

.time-slot {
    background: white;
    display: flex;
    border-bottom: 1px solid #dee2e6;
    position: relative;
    min-height: var(--slot-height, 60px);
}

.time-label {
    background: #e9ecef;
    padding: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #495057;
    text-align: center;
    border-right: 2px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    min-height: var(--slot-height, 60px);
    transition: min-height 0.3s ease, font-size 0.3s ease;
    flex-shrink: 0;
}

.slot-content {
    background: white;
    padding: 4px;
    min-height: var(--slot-height, 60px);
    position: relative;
    cursor: pointer;
    transition: background-color 0.2s ease, min-height 0.3s ease;
    flex: 1;
}

.slot-content:hover {
    background: #f0f8ff;
}

.slot-content.drag-over {
    background: #e3f2fd;
    border: 2px dashed var(--bg-primary);
}

/* Zoom Controls */
.btn-group .btn.active {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: white;
}

/* Balloon Cards */
.balloon-card {
    margin-bottom: 8px;
    cursor: grab;
    transition: var(--transition-smooth), height 0.3s ease, top 0.3s ease;
    position: relative;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.balloon-card.overlapping {
    box-shadow: 0 4px 12px rgba(255,0,0,0.3);
    border: 2px solid rgba(255,0,0,0.4);
}

.balloon-card.overlapping .card {
    background: rgba(255,245,245,0.95);
}

/* Overview mode - hide balloon action buttons initially, show on hover */
.balloon-actions {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.balloon-card:hover .balloon-actions {
    opacity: 1;
}

/* In detailed mode, always show actions */
.detailed-view .balloon-actions {
    opacity: 1;
}

/* Light theme adjustments */
.navbar {
    background: #fff !important;
    border-bottom: 1px solid #dee2e6;
}

.card {
    background: #fff;
    border: 1px solid #dee2e6;
}

.day-header {
    background: linear-gradient(135deg, #007bff, #0056b3) !important;
    color: white;
}

.time-column {
    background: #fff;
    border-right: 1px solid #dee2e6;
}

.track-column {
    background: #f8f9fa;
    border-right: 1px solid #dee2e6;
}

.time-slot {
    background: #fff;
    border-bottom: 1px solid #e9ecef;
}

.time-slot:hover {
    background: #f8f9fa;
}

.btn-primary {
    background-color: #007bff;
    border-color: #007bff;
}

.text-primary {
    color: #007bff !important;
}

.balloon-card:hover {
    transform: scale(1.02);
    z-index: 20;
}

.balloon-card.dragging {
    opacity: 0.8;
    transform: rotate(3deg) scale(0.98);
    cursor: grabbing;
    z-index: 1000;
}

.balloon-card .card {
    border-radius: 8px;
    margin-bottom: 0;
}

.balloon-card .card-body {
    padding: 0.75rem;
}

.balloon-card .card-title {
    font-size: 0.9rem;
    line-height: 1.3;
    margin-bottom: 0.5rem;
}

.balloon-card .card-text {
    font-size: 0.8rem;
    line-height: 1.2;
}

/* Overview mode adjustments */
:root[style*="--slot-height: 12px"] .time-label {
    font-size: 0.6rem;
    padding: 2px 4px;
}

:root[style*="--slot-height: 12px"] .balloon-card .card-title {
    font-size: 0.7rem;
    margin-bottom: 0.25rem;
}

:root[style*="--slot-height: 12px"] .balloon-card .card-text {
    display: none; /* Hide description in overview mode */
}

:root[style*="--slot-height: 12px"] .balloon-card .btn-group {
    opacity: 0; /* Make buttons invisible but keep them accessible */
    transition: opacity 0.2s ease;
}

:root[style*="--slot-height: 12px"] .balloon-card:hover .btn-group {
    opacity: 1; /* Show buttons on hover in overview mode */
}

:root[style*="--slot-height: 12px"] .balloon-card .card-body {
    padding: 0.25rem;
}

/* Color-coded borders for balloons */
.border-primary { border-color: var(--bg-primary) !important; }
.border-success { border-color: var(--bg-success) !important; }
.border-warning { border-color: var(--bg-warning) !important; }
.border-info { border-color: var(--bg-info) !important; }
.border-secondary { border-color: var(--bg-secondary) !important; }

.bg-primary { 
    background-color: var(--bg-primary) !important; 
    color: white !important;
}
.bg-success { 
    background-color: var(--bg-success) !important; 
    color: white !important;
}
.bg-warning { 
    background-color: var(--bg-warning) !important; 
    color: #333 !important;
}
.bg-info { 
    background-color: var(--bg-info) !important; 
    color: #333 !important;
}
.bg-secondary { 
    background-color: var(--bg-secondary) !important; 
    color: white !important;
}

/* Ensure text is readable on balloon cards */
.balloon-card.bg-primary,
.balloon-card.bg-secondary {
    color: white !important;
}

.balloon-card.bg-primary .card-title,
.balloon-card.bg-secondary .card-title,
.balloon-card.bg-primary .card-text,
.balloon-card.bg-secondary .card-text,
.balloon-card.bg-primary small,
.balloon-card.bg-secondary small {
    color: rgba(255, 255, 255, 0.95) !important;
}

/* Unallocated Area */
#unallocated-area {
    min-height: 300px;
    max-height: 70vh;
    overflow-y: auto;
    border-radius: 8px;
}

#unallocated-area.drag-over {
    background: #fff3cd;
    border: 2px dashed #ffc107;
}

/* List View Styles */
.schedule-container {
    margin-bottom: 2rem;
}

.table-responsive {
    border-radius: 8px;
    overflow: hidden;
}

.table {
    margin-bottom: 0;
}

.table thead th {
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    vertical-align: middle;
    position: relative;
}

.sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}

.sortable:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sort-icon {
    opacity: 0.5;
    font-size: 0.8rem;
    margin-left: 0.5rem;
    transition: opacity 0.2s ease;
}

.sortable:hover .sort-icon {
    opacity: 1;
}

.session-row {
    transition: background-color 0.2s ease;
}

.session-row:hover {
    background: rgba(74, 144, 226, 0.1);
}

.session-row.unallocated {
    background: rgba(255, 193, 7, 0.1);
}

.time-range {
    line-height: 1.2;
}

.session-info h6 {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.speaker-info {
    font-weight: 500;
}

.category-indicator {
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Public View Styles */
.public-view .bg-gradient-primary {
    background: linear-gradient(135deg, var(--bg-primary), #357abd) !important;
}

.timeline-item {
    padding-left: 1rem;
    margin-left: 1rem;
    position: relative;
}

.timeline-item:not(:last-child) {
    border-bottom: 1px solid #e9ecef;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 1.5rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 3px white;
}

.time-badge {
    border-radius: 8px;
    font-size: 0.85rem;
    line-height: 1.2;
    min-width: 80px;
}

/* Modal Enhancements */
.modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.3);
}

.modal-header {
    border-bottom: 1px solid #e9ecef;
    border-radius: 12px 12px 0 0;
}

.modal-footer {
    border-top: 1px solid #e9ecef;
    border-radius: 0 0 12px 12px;
}

/* Form Enhancements */
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #ced4da;
    transition: var(--transition-smooth);
}

.form-control:focus, .form-select:focus {
    border-color: var(--bg-primary);
    box-shadow: 0 0 0 0.2rem rgba(74, 144, 226, 0.25);
}

/* Badge Enhancements */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
    border-radius: 6px;
}

/* Navigation Enhancements */
.navbar-brand {
    font-size: 1.4rem;
}

.navbar {
    box-shadow: var(--balloon-shadow);
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--bg-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .time-slots {
        grid-template-columns: 60px 1fr;
    }
    
    .time-label {
        font-size: 0.7rem;
        padding: 6px;
    }
    
    .balloon-card .card-body {
        padding: 0.5rem;
    }
    
    .balloon-card .card-title {
        font-size: 0.8rem;
    }
    
    .balloon-card .card-text {
        font-size: 0.7rem;
    }
    
    .btn-group-sm .btn {
        padding: 0.25rem 0.4rem;
        font-size: 0.7rem;
    }
    
    .day-header {
        padding: 1rem;
    }
    
    .day-header h4 {
        font-size: 1.1rem;
    }
    
    .table {
        font-size: 0.85rem;
    }
    
    .time-badge {
        font-size: 0.75rem;
        min-width: 60px;
    }
}

@media (max-width: 480px) {
    .display-5 {
        font-size: 1.8rem;
    }
    
    .lead {
        font-size: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .btn-group .btn {
        margin-bottom: 0.25rem;
        border-radius: 8px !important;
    }
    
    .time-slots {
        grid-template-columns: 50px 1fr;
    }
    
    .balloon-card .btn-group-sm {
        flex-direction: column;
    }
}

/* Print Styles */
@media print {
    body {
        background: white !important;
        font-size: 12px;
    }
    
    .navbar, .btn, .modal, .dropdown-menu {
        display: none !important;
    }
    
    .card {
        border: 1px solid #ddd !important;
        box-shadow: none !important;
        page-break-inside: avoid;
        margin-bottom: 1rem;
    }
    
    .day-section {
        page-break-before: auto;
        page-break-after: auto;
        page-break-inside: avoid;
    }
    
    .balloon-card {
        box-shadow: none !important;
        transform: none !important;
    }
    
    .table {
        font-size: 11px;
    }
    
    .badge {
        border: 1px solid #ddd;
    }
    
    .bg-primary, .bg-success, .bg-warning, .bg-info, .bg-secondary {
        color: #000 !important;
    }
    
    .text-white {
        color: #000 !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid #000;
    }
    
    .balloon-card .card {
        border-width: 3px;
    }
    
    .badge {
        border: 1px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .balloon-card:hover {
        transform: none;
    }
    
    .card:hover {
        transform: none;
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Focus indicators for accessibility */
.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: 2px solid var(--bg-primary);
    outline-offset: 2px;
}

.balloon-card:focus-within {
    outline: 2px solid var(--bg-primary);
    outline-offset: 2px;
}

/* Animation for new elements */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-in {
    animation: fadeInUp 0.3s ease-out;
}

/* Error and success states */
.is-invalid {
    border-color: #dc3545 !important;
}

.is-valid {
    border-color: #28a745 !important;
}

.alert {
    border-radius: 8px;
    border: none;
}

.alert-dismissible .btn-close {
    padding: 0.75rem;
}
