/* Custom styles for SBVE website - Sankta Birgitta Vokalensemble style */

@import url('https://fonts.googleapis.com/css2?family=Cormorant:wght@400;700&family=Josefin+Sans:wght@400;700&display=swap');

/* Default theme variables (Birgitta) */
:root {
    --primary-color: #3b5998;
    --primary-font: 'Cormorant', serif;
    --secondary-font: 'Josefin Sans', sans-serif;
    --text-color: #333;
    --bg-color: #fff;
}

body {
    font-family: var(--secondary-font);
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
}

/* Header and Navigation */
.navbar {
    background-color: var(--primary-color) !important;
    padding: 1rem 0;
    box-shadow: none;
    border-bottom: 1px solid #e0e0e0;
}

.navbar-brand {
    font-family: var(--primary-font);
    font-weight: 700;
    font-size: 2rem;
    color: #fff !important;
}

.navbar-nav .nav-link {
    color: #fff !important;
    font-weight: 400;
    padding: 0.5rem 1rem;
}

.navbar-nav .nav-link.active {
    font-weight: 700;
}

/* Typography */
h1 {
    font-family: var(--primary-font);
    font-weight: 700;
    color: var(--primary-color);
}

/* Typography */
h2, h3 {
    font-family: var(--primary-font);
    font-weight: 700;
    color: white;
}

/* Fix for card header buttons */
.card-header .btn {
    color: white !important;
}

.card-header .btn:hover {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* Fix for calendar card header button */
.card-header.bg-gradient .btn {
    background: none !important;
    border: none !important;
}

.card-header.bg-gradient .btn:focus,
.card-header.bg-gradient .btn:active {
    background: none !important;
    box-shadow: none !important;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
}

/* Cards */
.card {
    border: none;
    border-radius: 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.card-header {
    background-color: var(--primary-color);
    color: white;
    font-family: var(--primary-font);
    font-weight: 700;
    padding: 1rem;
}

.card-body {
    padding: 1.5rem;
}

/* Images */
.img-fluid {
    border-radius: 0 !important;
}

/* Footer */
footer {
    background-color: var(--primary-color) !important;
    padding: 1.5rem 0;
    margin-top: 3rem;
}

/* List groups */
.list-group-item {
    border-left: none;
    border-right: none;
    padding: 1rem 1.25rem;
}

/* Accordion styles */
.accordion-item {
    border: none;
    margin-bottom: 1rem;
}

.accordion-button {
    background-color: var(--primary-color);
    color: white;
    font-family: var(--primary-font);
    font-weight: 700;
    font-size: 1.5rem;
    padding: 1rem;
}

.accordion-button:not(.collapsed) {
    background-color: var(--primary-color);
    color: white;
    box-shadow: none;
}

.accordion-button:focus {
    box-shadow: none;
    border-color: rgba(0,0,0,.125);
}

.accordion-button::after {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
}

.accordion-button:not(.collapsed)::after {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
}

.accordion-body {
    padding: 1.5rem;
    background-color: #fff;
}

/* Gallery styles */
.thumbnail {
    height: 200px;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.thumbnail:hover {
    transform: scale(1.05);
}

/* Lightbox customization */
.lb-data .lb-caption {
    font-family: var(--primary-font);
    font-weight: 700;
    font-size: 1.2rem;
    color: #fff;
}

.lb-data .lb-number {
    font-family: var(--secondary-font);
}

/* Members page - single column layout */
.accordion-body .row .col-md-6 {
    flex: 0 0 100%;
    max-width: 100%;
}

/* Member hiatus styling */
.member-hiatus {
    color: #6c757d !important;
    font-style: italic;
}

/* Low attendance styling */
.low-attendance td {
    color: #0d6efd !important;
}

/* Touch-friendly buttons */
@media (pointer: coarse) {
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* Image optimization for different screen densities */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .high-dpi img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Masonry gallery layout */
.gallery-grid {
    column-count: 4;
    column-gap: 1rem;
    column-fill: balance;
}

/* Responsive masonry columns */
@media (max-width: 1200px) {
    .gallery-grid {
        column-count: 3;
    }
}

@media (max-width: 992px) {
    .gallery-grid {
        column-count: 3;
        column-gap: 0.75rem;
    }
}

.gallery-item {
    display: inline-block;
    width: 100%;
    margin-bottom: 1rem;
    break-inside: avoid;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.02);
}



/* Enhanced image optimization styles */
.lazy {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

.lazy.loaded {
    opacity: 1;
    background: none;
    animation: none;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Responsive image containers */
.img-responsive {
    width: 100%;
    height: auto;
    display: block;
}

.img-container {
    position: relative;
    overflow: hidden;
}

.img-container::before {
    content: '';
    display: block;
    padding-top: 56.25%; /* 16:9 aspect ratio */
}

.img-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Progressive loading blur effect */
.progressive-img {
    transition: filter 0.3s ease;
}

.progressive-img.loading {
    filter: blur(5px);
}

/* WebP fallback indicator */
.webp-supported .no-webp {
    display: none;
}

.no-webp-support .webp-only {
    display: none;
}

/* Loading states */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-content {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    text-align: center;
}

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

/* Error states */
.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 1rem;
    border-radius: 4px;
    border: 1px solid #f5c6cb;
    margin: 1rem 0;
}

.retry-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 0.5rem;
}

.retry-button:hover {
    opacity: 0.9;
}

/* Accessibility improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

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

/* Skip to content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-color);
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 10000;
}

.skip-link:focus {
    top: 6px;
}

/* Calendar Styles */
.calendar-cell {
    height: 120px;
    vertical-align: top;
    padding: 8px;
    border: 1px solid #dee2e6;
    position: relative;
}

.calendar-cell.other-month {
    background-color: #f8f9fa;
    color: #6c757d;
}

.calendar-cell.today {
    background-color: #e3f2fd;
    border-color: var(--primary-color);
}

.day-number {
    font-weight: bold;
    margin-bottom: 4px;
}

.day-events {
    font-size: 0.75rem;
}

.event-item {
    background-color: var(--primary-color);
    color: white;
    padding: 2px 4px;
    margin: 1px 0;
    border-radius: 3px;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.event-item:hover {
    opacity: 0.8;
}

/* Busy/Free event styling */
.event-busy {
    background-color: var(--primary-color) !important;
    border-left: 4px solid #dc3545;
}

.event-free {
    background-color: #28a745 !important;
    border-left: 4px solid #20c997;
    opacity: 0.8;
}

.event-card.event-free {
    border-left: 4px solid #28a745;
    background-color: rgba(40, 167, 69, 0.05);
}

.event-card.event-busy {
    border-left: 4px solid var(--primary-color);
}

.event-item[title] {
    position: relative;
}

.event-item[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: pre-line;
    z-index: 1000;
    min-width: 200px;
    text-align: left;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

.event-item[title]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(1px);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
    z-index: 1001;
    pointer-events: none;
}

.event-card {
    transition: box-shadow 0.2s ease;
}

.event-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.calendar-view {
    min-height: 400px;
}

/* Mobile improvements */
@media (max-width: 768px) {
    .calendar-cell {
        height: 80px;
        padding: 4px;
    }
    
    .day-events {
        font-size: 0.65rem;
    }
    
    .event-item {
        padding: 1px 2px;
        margin: 0.5px 0;
    }
    .navbar-brand {
        font-size: 1.5rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .accordion-button {
        font-size: 1.25rem;
        padding: 0.75rem;
    }
    
    .thumbnail {
        height: 150px;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    /* Mobile filter controls */
    .filter-controls {
        width: 100%;
    }
    
    .filter-controls .btn-group {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        margin-bottom: 1rem;
        width: 100%;
    }
    
    .filter-controls .btn {
        flex: 1;
        min-width: calc(50% - 0.25rem);
        min-height: 48px;
        font-size: 0.9rem;
        border-radius: 0.375rem !important;
        margin: 0;
    }
    
    .d-flex.justify-content-between {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .navbar-nav {
        text-align: center;
    }
    
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Mobile-optimized member cards */
    .member-item {
        padding: 1rem !important;
        margin-bottom: 0.5rem;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    
    .member-item .d-flex {
        flex-direction: column;
        align-items: stretch !important;
        gap: 1rem;
    }
    
    .member-item .text-end {
        text-align: left !important;
        width: 100%;
    }
    
    /* Mobile member info layout */
    .member-info {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .member-name {
        font-size: 1.1rem;
        font-weight: 600;
        line-height: 1.3;
    }
    
    .member-contact {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .contact-item {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.5rem;
        background-color: #f8f9fa;
        border-radius: 6px;
    }
    
    .contact-item a {
        color: var(--primary-color);
        text-decoration: none;
        font-weight: 500;
    }
    
    /* Mobile WhatsApp button */
    .btn-whatsapp {
        width: 100%;
        min-height: 48px;
        font-size: 1rem;
        font-weight: 600;
        border-radius: 8px;
        margin-top: 0.5rem;
    }
    
    /* Mobile voice sections */
    .voice-section {
        margin-bottom: 1.5rem;
    }
    
    .voice-section .card {
        border-radius: 12px;
        overflow: hidden;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    }
    
    .voice-section .card-header {
        padding: 1rem;
        font-size: 1.1rem;
    }
    
    .voice-section .list-group-flush {
        border-radius: 0;
    }
    
    /* Mobile form improvements */
    .form-control,
    .form-select {
        font-size: 16px; /* Prevents zoom on iOS */
        min-height: 48px;
    }
    
    .modal-dialog {
        margin: 1rem;
    }
    
    /* Mobile masonry optimizations */
    .gallery-grid {
        column-count: 2;
        column-gap: 0.5rem;
    }
    
    .gallery-item {
        margin-bottom: 0.5rem;
    }
    
    .img-container::before {
        padding-top: 75%; /* 4:3 aspect ratio for mobile */
    }
    
    /* Mobile birthday modal */
    .modal-body .row {
        flex-direction: column;
    }
    
    .modal-body .col-md-6 {
        margin-bottom: 1.5rem;
    }
}

@media (max-width: 576px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .display-4 {
        font-size: 1.75rem;
    }
    
    .lead {
        font-size: 1rem;
    }
    
    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
    
    /* Extra small screen masonry optimizations */
    .gallery-grid {
        column-count: 1;
        column-gap: 0.5rem;
    }
    
    .thumbnail {
        height: 120px;
    }
    
    .img-container::before {
        padding-top: 100%; /* Square aspect ratio for very small screens */
    }
}
/* Admin page specific styles */
.admin-table { width: 100%; }
.admin-table td { padding: 0.25rem !important; }
.admin-table th:nth-child(1), .admin-table td:nth-child(1) { width: 5%; }
.admin-table th:nth-child(2), .admin-table td:nth-child(2) { width: 8%; }
.admin-table th:nth-child(3), .admin-table td:nth-child(3) { width: 4%; }
.admin-table th:nth-child(4), .admin-table td:nth-child(4) { width: 8%; }
.admin-table th:nth-child(5), .admin-table td:nth-child(5) { width: 50%; }
.admin-table th:nth-child(6), .admin-table td:nth-child(6) { width: 10%; }
.admin-table th:nth-child(7), .admin-table td:nth-child(7) { width: 2%; }
.admin-table th:nth-child(8), .admin-table td:nth-child(8) { width: 2%; }
.admin-table th:nth-child(9), .admin-table td:nth-child(9) { width: 2%; }
.admin-table th:nth-child(10), .admin-table td:nth-child(10) { width: 4%; }
.admin-table th:nth-child(11), .admin-table td:nth-child(11) { width: 2%; }
.admin-table th:nth-child(12), .admin-table td:nth-child(12) { width: 2%; }
.admin-table th:nth-child(13), .admin-table td:nth-child(13) { width: 1%; }

.copy-command-input { cursor: text !important; }
.copy-btn { cursor: pointer; }
.copy-btn:hover { background-color: var(--primary-color) !important; color: white !important; }

.event-form-modal .modal-content { border: none; border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15); }
.event-form-modal .modal-header { border-radius: 12px 12px 0 0; border-bottom: none; padding: 1.5rem; }
.event-form-modal .modal-footer { border-radius: 0 0 12px 12px; border-top: 1px solid #e9ecef; }

.form-section { background: #f8f9fa; border-radius: 8px; padding: 1.5rem; border-left: 4px solid var(--primary-color); }
.section-header { color: #495057; font-size: 1rem; border-bottom: 1px solid #dee2e6; padding-bottom: 0.5rem; }

.time-presets .btn, .location-presets .btn { border-radius: 20px; font-size: 0.85rem; padding: 0.25rem 0.75rem; }

#eventsTableBody tr { border-bottom: 2px solid #e9ecef !important; transition: all 0.2s ease; }
#eventsTableBody tr:hover { background-color: #e3f2fd !important; box-shadow: 0 2px 8px rgba(0,0,0,0.1); transform: translateY(-1px); }
#eventsTableBody td { padding: 1rem 0.75rem; vertical-align: top; border-left: 4px solid transparent; }

#eventsTableBody tr:has(.fa-music) td:first-child { border-left-color: #28a745; }
#eventsTableBody tr:has(.fa-microphone) td:first-child { border-left-color: #dc3545; }
#eventsTableBody tr:has(.fa-users) td:first-child { border-left-color: #ffc107; }
#eventsTableBody tr:has(.fa-calendar) td:first-child { border-left-color: #007bff; }

#eventsTableBody .fa-music { color: #28a745; }
#eventsTableBody .fa-microphone { color: #dc3545; }
#eventsTableBody .fa-users { color: #ffc107; }
#eventsTableBody .fa-calendar { color: #007bff; }

.table-responsive table thead th:nth-child(1), .table-responsive table tbody td:nth-child(1) { width: 10%; }
.table-responsive table thead th:nth-child(2), .table-responsive table tbody td:nth-child(2) { width: 50%; }
.table-responsive table thead th:nth-child(3), .table-responsive table tbody td:nth-child(3) { width: 5%; }
.table-responsive table thead th:nth-child(4), .table-responsive table tbody td:nth-child(4) { width: 15%; }
.table-responsive table thead th:nth-child(5), .table-responsive table tbody td:nth-child(5) { width: 10%; }

@media (max-width: 768px) {
    .event-form-modal .modal-dialog { margin: 0.5rem; }
    .form-section { padding: 1rem; }
    .time-presets .btn, .location-presets .btn { font-size: 0.8rem; padding: 0.2rem 0.6rem; margin-bottom: 0.25rem; }
    #eventsTableBody td { padding: 0.75rem 0.5rem; }
}