/* Spaces Page Styles - Enhanced for Find A Space */

/* Page-specific variables */
:root {
    --primary-color: #007BFF;
    --secondary-color: #F8F9FA;
    --accent-color: #28A745;
    --warning-color: #FFC107;
    --danger-color: #DC3545;
    --text-dark: #2C3E50;
    --text-light: #6C757D;
    --white: #FFFFFF;
    --border-color: #E9ECEF;
    --shadow-light: 0 2px 15px rgba(0,0,0,0.1);
    --shadow-medium: 0 4px 25px rgba(0,0,0,0.15);
    --shadow-strong: 0 8px 35px rgba(0,0,0,0.2);
    --border-radius: 12px;
    --border-radius-lg: 20px;
    --transition: all 0.3s ease;
    --transition-fast: all 0.2s ease;
}

/* Page Hero Section */
.page-hero {
    position: relative;
    height: 70vh;
    display: flex;
    align-items: center;
    overflow: hidden;
    background: linear-gradient(135deg, var(--primary-color), #0056B3);
}

.page-hero .hero-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.page-hero .hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(0, 123, 255, 0.85), rgba(0, 86, 179, 0.85));
    z-index: 2;
}

.page-hero .hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.page-hero .hero-content {
    position: relative;
    z-index: 3;
}

.page-hero .breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 1rem;
}

.page-hero .breadcrumb-item + .breadcrumb-item::before {
    content: ">";
    color: rgba(255, 255, 255, 0.7);
}

.page-hero .breadcrumb-item a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: var(--transition);
}

.page-hero .breadcrumb-item a:hover {
    color: var(--warning-color);
}

.page-hero .breadcrumb-item.active {
    color: var(--white);
}

/* Hero Stats */
.hero-stats {
    margin-top: 2rem;
}

.stat-item {
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--border-radius);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: var(--transition);
}

.stat-item:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-5px);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--white);
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
    margin: 0;
    color: var(--white);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Filters Section */
.filters-section {
    background: var(--secondary-color);
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
    box-shadow: var(--shadow-light);
    padding: 0.75rem 0; /* Reduced padding to decrease height */
}

.filters-section.sticky {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
    background: rgba(248, 249, 250, 0.95);
    padding: 0.5rem 0; /* Further reduced padding when sticky */
}

.filter-wrapper {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 1rem 1.5rem; /* Reduced vertical padding */
    box-shadow: var(--shadow-medium);
    border: 1px solid var(--border-color);
}

.filter-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.filter-select {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    font-size: 0.9rem;
    background: var(--white);
    transition: var(--transition-fast);
}

.filter-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    outline: none;
}

.filter-select:hover {
    border-color: var(--primary-color);
}

/* Results Section */
.results-section {
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
}

.results-info {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 1.1rem;
}

.view-toggle .btn {
    border-radius: var(--border-radius-lg);
    margin-left: 0.5rem;
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    transition: var(--transition-fast);
}

.view-toggle .btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--white);
}

.view-toggle .btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Space Cards */
.space-card {
    background: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-light);
    transition: var(--transition);
    height: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
}

.space-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-strong);
    border-color: var(--primary-color);
}

.space-image {
    position: relative;
    height: 220px;
    overflow: hidden;
}

.space-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.space-card:hover .space-image img {
    transform: scale(1.1);
}

.space-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, transparent, rgba(0,0,0,0.7));
    display: flex;
    align-items: flex-end;
    padding: 1rem;
}

.space-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.availability {
    padding: 0.4rem 0.8rem;
    border-radius: var(--border-radius-lg);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    backdrop-filter: blur(5px);
}

.availability.available {
    background: var(--accent-color);
    color: var(--white);
}

.availability.limited {
    background: var(--warning-color);
    color: var(--text-dark);
}

.availability.full {
    background: var(--danger-color);
    color: var(--white);
}

.space-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.space-title {
    color: var(--text-dark);
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.space-location {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}

.space-location i {
    color: var(--primary-color);
    margin-right: 0.5rem;
}

.space-features {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.feature-tag {
    background: var(--secondary-color);
    color: var(--text-dark);
    padding: 0.4rem 0.8rem;
    border-radius: var(--border-radius);
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
    transition: var(--transition-fast);
}

.feature-tag:hover {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.feature-tag i {
    color: var(--primary-color);
    margin-right: 0.3rem;
}

.feature-tag:hover i {
    color: var(--white);
}

.facilities {
    margin-top: 1rem;
}

.facility-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.5rem;
}

.facility-item {
    background: #f1f3f4;
    padding: 0.25rem 0.6rem;
    border-radius: var(--border-radius);
    font-size: 0.75rem;
    color: var(--text-light);
    border: 1px solid #e0e0e0;
}

.space-actions {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.space-actions .btn {
    border-radius: var(--border-radius-lg);
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: var(--transition);
}

.space-actions .btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #0056B3);
    border: none;
}

.space-actions .btn-primary:hover {
    background: linear-gradient(135deg, #0056B3, var(--primary-color));
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
}

/* Modal Styling */
.modal-header {
    background: linear-gradient(135deg, var(--primary-color), #0056B3);
    color: var(--white);
    border-bottom: none;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.modal-header .btn-close {
    filter: invert(1);
}

.modal-body {
    padding: 2rem;
}

.modal-xl {
    max-width: 1200px;
}

.space-preview img {
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-medium);
}

.space-details-modal {
    background: var(--secondary-color);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-top: 1rem;
    border: 1px solid var(--border-color);
}

/* Time Slots */
.time-slots-container {
    margin-top: 1rem;
}

.time-slots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.75rem;
    max-height: 350px;
    overflow-y: auto;
    padding: 1.5rem;
    background: var(--secondary-color);
    border-radius: var(--border-radius);
    border: 2px solid var(--border-color);
}

.time-slot {
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--white);
}

.time-slot.available {
    border-color: var(--accent-color);
}

.time-slot.available:hover {
    background: var(--accent-color);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.time-slot.selected {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.time-slot.reserved {
    background: var(--danger-color);
    border-color: var(--danger-color);
    color: var(--white);
    cursor: not-allowed;
    opacity: 0.8;
}

.time-text {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.status-text {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    opacity: 0.8;
}

/* Clear Filters Button */
#clearFilters {
    height: auto; /* Remove fixed height to allow natural sizing */
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border: 2px solid var(--border-color);
    transition: var(--transition-fast);
    padding: 0.75rem 1rem; /* Match padding with form elements */
    min-height: 48px; /* Ensure consistent minimum height */
    margin-top: auto; /* Align to bottom of container when flex-column is used */
}

#clearFilters:hover {
    background: var(--danger-color);
    border-color: var(--danger-color);
    color: var(--white);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.2);
}

#clearFilters:active {
    transform: translateY(0);
}

/* Ensure proper alignment of filter columns */
.filter-wrapper .col-md-2 {
    display: flex;
    flex-direction: column;
}

.filter-wrapper .col-md-2:last-child {
    justify-content: flex-end; /* Align clear button to bottom */
}

/* Form Styling */
.form-label {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.3px;
}

.form-control,
.form-select {
    border-radius: var(--border-radius);
    border: 2px solid var(--border-color);
    padding: 0.75rem;
    transition: var(--transition-fast);
    background: var(--white);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    outline: none;
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Success Modal */
.success-animation i {
    animation: successPulse 2s infinite;
}

@keyframes successPulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

.booking-summary {
    background: var(--secondary-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    margin: 1rem 0;
    border: 1px solid var(--border-color);
}

/* No Results */
.no-results-content {
    padding: 4rem 2rem;
    text-align: center;
}

.no-results-content i {
    opacity: 0.5;
    margin-bottom: 1rem;
}

.no-results-content h4 {
    color: var(--text-dark);
    margin-bottom: 1rem;
}

.no-results-content p {
    color: var(--text-light);
    margin-bottom: 2rem;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #0056B3);
    border: none;
    border-radius: var(--border-radius-lg);
    padding: 0.75rem 2rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: var(--transition);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0056B3, var(--primary-color));
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, var(--accent-color), #1e7e34);
    border: none;
    border-radius: var(--border-radius-lg);
    padding: 0.75rem 2rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-success:hover {
    background: linear-gradient(135deg, #1e7e34, var(--accent-color));
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.btn-secondary {
    border-radius: var(--border-radius-lg);
    padding: 0.75rem 2rem;
    font-weight: 600;
    border: 2px solid var(--border-color);
}

.btn-outline-secondary {
    border-radius: var(--border-radius-lg);
    border: 2px solid var(--border-color);
    color: var(--text-light);
}

.btn-outline-secondary:hover {
    background: var(--text-light);
    border-color: var(--text-light);
    color: var(--white);
}

/* Loading States */
.btn.loading {
    position: relative;
    color: transparent;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-top: -8px;
    margin-left: -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 1199.98px) {
    .modal-xl {
        max-width: 95%;
    }
    
    .time-slots-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 0.5rem;
        padding: 1rem;
    }
}

@media (max-width: 991.98px) {
    .page-hero {
        height: 60vh;
        margin-top: 150px; /* Reduced margin for mobile smaller header */
    }
    
    .hero-stats .stat-item {
        margin-bottom: 1rem;
    }
    
    .filter-wrapper {
        padding: 0.75rem 1rem; /* Reduced padding for mobile */
    }
    
    .filter-label {
        font-size: 0.8rem;
        margin-bottom: 0.25rem; /* Reduced margin for tighter layout */
    }
    
    .filter-select {
        padding: 0.5rem;
        font-size: 0.85rem;
    }
    
    #clearFilters {
        min-height: 40px; /* Smaller height on mobile */
        font-size: 0.85rem;
        padding: 0.5rem 0.75rem;
    }
    
    .view-toggle {
        margin-top: 1rem;
        text-align: center;
    }
    
    .space-card {
        margin-bottom: 1.5rem;
    }
}

@media (max-width: 767.98px) {
    .page-hero {
        height: 50vh;
        margin-top: 120px; /* Further reduced margin for smaller mobile screens */
    }
    
    .page-hero .hero-content h1 {
        font-size: 2rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .filters-section {
        padding: 0.5rem 0; /* Even more compact on mobile */
    }
    
    .filter-wrapper {
        padding: 0.5rem 0.75rem; /* More compact padding */
    }
    
    .filter-wrapper .row {
        --bs-gutter-x: 0.75rem; /* Reduced gutter for mobile */
    }
    
    .filter-label {
        font-size: 0.75rem;
        margin-bottom: 0.2rem;
    }
    
    #clearFilters {
        min-height: 36px; /* Even smaller on small mobile */
        font-size: 0.8rem;
        padding: 0.4rem 0.6rem;
    }
    
    .space-content {
        padding: 1rem;
    }
    
    .space-image {
        height: 180px;
    }
    
    .time-slots-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        max-height: 250px;
        padding: 0.75rem;
    }
    
    .time-slot {
        padding: 0.75rem 0.5rem;
    }
    
    .time-text {
        font-size: 0.8rem;
    }
    
    .status-text {
        font-size: 0.7rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .space-preview {
        margin-bottom: 2rem;
    }
    
    .booking-summary {
        padding: 1rem;
    }
    
    .no-results-content {
        padding: 2rem 1rem;
    }
}

@media (max-width: 575.98px) {
    .page-hero .hero-content h1 {
        font-size: 1.75rem;
    }
    
    .stat-item {
        padding: 1rem;
    }
    
    .stat-number {
        font-size: 1.75rem;
    }
    
    .filter-wrapper .row {
        gap: 0.5rem;
    }
    
    .space-features {
        justify-content: center;
    }
    
    .feature-tag {
        font-size: 0.75rem;
        padding: 0.3rem 0.6rem;
    }
    
    .space-actions .btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
    
    .time-slots-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
    
    .modal-header h5 {
        font-size: 1rem;
    }
}

/* Print Styles */
@media print {
    .page-hero,
    .filters-section,
    .results-section,
    .modal,
    .btn {
        display: none;
    }
    
    .space-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid var(--border-color);
        margin-bottom: 1rem;
    }
    
    .space-image {
        height: 150px;
    }
    
    .space-content {
        padding: 1rem;
    }
}

/* Accessibility Improvements */
.space-card:focus-within {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.time-slot:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Form and Dropdown Fixes - Ensure Light Backgrounds */
.form-control,
.form-select {
    background-color: #ffffff !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-dark) !important;
}

.form-control:focus,
.form-select:focus {
    background-color: #ffffff !important;
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25) !important;
}

.dropdown-menu {
    background-color: #ffffff !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: var(--shadow-medium) !important;
}

.dropdown-item {
    color: var(--text-dark) !important;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background-color: var(--secondary-color) !important;
    color: var(--text-dark) !important;
}

/* Card Background Fixes */
.card,
.space-card {
    background-color: #ffffff !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-dark) !important;
}

.modal-content {
    background-color: #ffffff !important;
    color: var(--text-dark) !important;
}

/* Dark mode support (controlled - only when explicitly enabled) */
@media (prefers-color-scheme: dark) {
    body.dark-mode-enabled {
        --white: #1a1a1a;
        --secondary-color: #2d2d2d;
        --text-dark: #ffffff;
        --text-light: #cccccc;
        --border-color: #404040;
    }
    
    body.dark-mode-enabled .space-card {
        background: #2d2d2d;
        border-color: #404040;
    }
    
    body.dark-mode-enabled .space-card:hover {
        border-color: var(--primary-color);
    }
    
    body.dark-mode-enabled .dropdown-menu {
        background-color: #2d2d2d;
        border-color: #404040;
    }
    
    body.dark-mode-enabled .form-control,
    body.dark-mode-enabled .form-select {
        background-color: #2d2d2d;
        border-color: #404040;
        color: #ffffff;
    }
}

/* Animation Enhancements */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.space-card {
    animation: fadeInUp 0.6s ease-out;
}

.filter-wrapper {
    animation: fadeInUp 0.4s ease-out;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom scrollbar for time slots */
.time-slots-grid::-webkit-scrollbar {
    width: 8px;
}

.time-slots-grid::-webkit-scrollbar-track {
    background: var(--secondary-color);
    border-radius: 4px;
}

.time-slots-grid::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.time-slots-grid::-webkit-scrollbar-thumb:hover {
    background: #0056B3;
}

/* Enhanced hover effects */
.space-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: var(--border-radius);
    z-index: -1;
}

.space-card:hover::before {
    opacity: 0.05;
}
