/* Public Shifts Page CSS */

/* Import base styles */
@import url("modules/base.css");
@import url("modules/buttons.css");
@import url("modules/forms.css");
@import url("modules/modal.css");
@import url("modules/notifications.css");
@import url("modules/layout.css");

/* Public header styles */
.public-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.public-header h1 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.header-actions .btn {
    min-width: auto;
    padding: 0.5rem 1rem;
}

/* Main container */
.public-shifts-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    padding-bottom: 120px; /* Extra padding for mobile navigation bars */
}

/* Intro section */
.shifts-intro {
    text-align: center;
    margin-bottom: 2rem;
}

.shifts-intro h2 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 2rem;
}

.shifts-intro p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Filters section */
.shifts-filters {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-group label {
    font-weight: 600;
    color: var(--text-primary);
}

.filter-group input[type="date"] {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
}

/* Loading state */
.shifts-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

/* Shifts grid */
.shifts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

/* Individual shift cards */
.shift-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.shift-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.shift-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.25rem;
    line-height: 1.3;
    flex: 1;
}

.shift-status {
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-open {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-full {
    background: #ffebee;
    color: #c62828;
}

.shift-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.shift-date,
.shift-time,
.shift-location {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
    font-size: 0.9rem;
}

/* Make icons smaller and consistent */
.shift-details .icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: #9e3fb5;
}

.shift-description {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 8px 0;
}

.shift-volunteers {
    margin-top: 8px;
}

.volunteer-bar {
    height: 6px;
    background: #f0f0f0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}

.volunteer-fill {
    height: 100%;
    background: linear-gradient(to right, #9e3fb5, #d946ef);
    transition: width 0.3s ease;
}

.volunteer-count {
    font-size: 0.85rem;
    color: #666;
}

.signup-btn {
    margin-top: 8px;
    padding: 10px 20px;
    font-size: 0.95rem;
}

/* No shifts message */
.no-shifts {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.no-shifts h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
}

/* Modal enhancements for public shifts */
.shift-details-modal {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--primary-color);
}

.shift-details-modal h4 {
    margin: 0 0 0.5rem 0;
    color: var(--primary-color);
}

.shift-details-modal .detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.5rem;
}

.shift-details-modal .detail-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.shift-details-modal .detail-label {
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 60px;
}

/* Form help text */
.form-help {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Signup info box */
.signup-info {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin: 1rem 0;
    border-left: 4px solid var(--info-color);
}

.signup-info p {
    margin: 0 0 0.5rem 0;
    font-weight: 600;
    color: var(--text-primary);
}

.signup-info ul {
    margin: 0;
    padding-left: 1.2rem;
}

.signup-info li {
    margin: 0.25rem 0;
    color: var(--text-secondary);
}

/* Button loading state */
.btn-loading {
    display: none;
}

.btn-text {
    display: inline;
}

#submit-signup[disabled] .btn-text {
    display: none !important;
}

#submit-signup[disabled] .btn-loading {
    display: inline !important;
}

/* Ensure hidden class works */
.hidden {
    display: none !important;
}

/* Success modal styling */
.success-content {
    text-align: center;
}

.success-content p {
    margin: 1rem 0;
}

.success-content ul {
    text-align: left;
    max-width: 300px;
    margin: 1rem auto;
}

.success-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

/* Status badges for shifts */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.status-open {
    background: var(--success-light);
    color: var(--success-color);
}

.status-badge.status-full {
    background: var(--warning-light);
    color: var(--warning-color);
}

.status-badge.status-cancelled {
    background: var(--error-light);
    color: var(--error-color);
}

/* Modal positioning - center on screen */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    overflow: auto;
}

.modal:not(.hidden) {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--border-radius);
    max-width: 500px;
    width: 90%;
    max-height: 85vh; /* Reduced from 90vh to ensure visibility on mobile */
    overflow-y: auto;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    margin: auto;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .public-shifts-container {
        padding: 1rem;
        padding-bottom: 100px; /* Extra padding for mobile nav bars */
    }
    
    .shifts-intro h2 {
        font-size: 1.6rem;
    }
    
    .shifts-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding-bottom: 80px; /* Additional padding for last card visibility */
    }
    
    .shift-card {
        padding: 1rem;
    }
    
    /* Ensure last card is visible above mobile navigation */
    .shift-card:last-child {
        margin-bottom: 20px;
    }
    
    .filter-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .success-actions {
        flex-direction: column;
    }
    
    /* Center modal on mobile with safe spacing */
    .modal-content {
        max-height: 75vh; /* Reduce height on mobile for better visibility */
        margin: 10vh auto; /* Center vertically with safe margins */
        width: 95%;
        max-width: calc(100vw - 20px);
    }
}

@media (max-width: 480px) {
    .public-header h1 {
        font-size: 1.4rem;
    }
    
    .header-actions {
        width: 100%;
        justify-content: center;
    }
    
    .shift-card {
        margin: 0;
    }
    
    /* Even more space for smaller screens with bottom navigation */
    .public-shifts-container {
        padding-bottom: 150px;
    }
    
    .shifts-grid {
        padding-bottom: 100px;
    }
    
    .modal-content {
        max-height: 70vh; /* Further reduce on small screens */
        margin: 15vh auto; /* More vertical centering space */
        width: calc(100vw - 20px);
    }
}

/* Account for iOS Safari bottom bar */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .public-shifts-container {
        padding-bottom: calc(120px + env(safe-area-inset-bottom));
    }
    
    @media (max-width: 768px) {
        .public-shifts-container {
            padding-bottom: calc(100px + env(safe-area-inset-bottom));
        }
        
        .shifts-grid {
            padding-bottom: calc(80px + env(safe-area-inset-bottom));
        }
    }
    
    @media (max-width: 480px) {
        .public-shifts-container {
            padding-bottom: calc(150px + env(safe-area-inset-bottom));
        }
        
        .shifts-grid {
            padding-bottom: calc(100px + env(safe-area-inset-bottom));
        }
    }
}
