/* Modern Events Page Styles */
.events-page {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f8f9ff;
    direction: rtl;
    display: flex;
    flex-direction: column;
    height: 95vh;
    overflow: hidden;
}

/* Page Header */
.page-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem 0;
    margin-bottom: 0;
    position: relative;
    flex-shrink: 0;
}

.login-bubble-wrapper {
    position: absolute;
    top: 1rem;
    right: 2rem;
    z-index: 1000;
}

/* Filters Section */
.filters-section {
    flex-shrink: 0;
    margin-bottom: 0;
}

/* Content Container */
.content-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-top: 1rem;
    padding-bottom: 1rem;
}

/* Events Container - scrollable area */
.events-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 #f7fafc;
}

.events-container::-webkit-scrollbar {
    width: 8px;
}

.events-container::-webkit-scrollbar-track {
    background: #f7fafc;
    border-radius: 4px;
}

.events-container::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 4px;
}

.events-container::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

.page-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="%23ffffff" opacity="0.05"/><circle cx="75" cy="75" r="1" fill="%23ffffff" opacity="0.05"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    pointer-events: none;
}

.page-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    position: relative;
    z-index: 2;
}

.page-subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    margin: 0;
    position: relative;
    z-index: 2;
}

/* Content Container */
.content-container {
    padding: 0 1rem;
}

/* Loading States */
.loading-state {
    text-align: center;
    padding: 4rem 0;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e3e6f0;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

.loading-text {
    color: #666;
    font-size: 1.1rem;
    margin: 0;
}

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

/* Auth Required Card */
.auth-required-card {
    text-align: center;
    background: white;
    border-radius: 16px;
    padding: 3rem 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    max-width: 400px;
    margin: 2rem auto;
}

.auth-required-card .card-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(45deg, #ffa726, #ff7043);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 1.8rem;
    color: white;
}

.auth-required-card h3 {
    color: #333;
    margin-bottom: 1rem;
}

.auth-required-card p {
    color: #666;
    margin-bottom: 1.5rem;
}

/* Events Grid */
.events-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
}

/* Event Cards */
.event-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 1px solid rgba(102, 126, 234, 0.1);
}

.event-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    border-color: rgba(102, 126, 234, 0.2);
}

.event-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.date-badges {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
}

.event-date-badge {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border-radius: 12px;
    padding: 0.75rem;
    text-align: center;
    min-width: 70px;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.hebrew-date-badge {
    background: linear-gradient(45deg, #ff6b6b, #ee5a6f);
    color: white;
    border-radius: 8px;
    padding: 0.4rem 0.6rem;
    text-align: center;
    min-width: 70px;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.2;
    box-shadow: 0 2px 8px rgba(238, 90, 111, 0.3);
    direction: rtl;
    font-family: 'David Libre', 'Noto Sans Hebrew', serif;
}

.event-date-badge .month {
    display: block;
    font-size: 0.7rem;
    opacity: 0.9;
    font-weight: 500;
    margin-top: 0.25rem;
}

.event-info {
    flex: 1;
}

.event-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
    line-height: 1.2;
}

.event-date {
    color: #666;
    font-size: 0.9rem;
    margin: 0;
}

.shabbat-times {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.85rem;
}

.candle-lighting {
    color: #d4a574;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.havdalah {
    color: #6b73d9;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.candle-lighting i,
.havdalah i {
    font-size: 0.75rem;
    width: 14px;
    text-align: center;
}

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

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9ff;
    border: 1px solid #e3e6f0;
    color: #667eea;
    transition: all 0.2s ease;
    padding: 0;
}

.btn-icon:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: scale(1.05);
}

.btn-icon.btn-danger {
    color: #dc3545;
}

.btn-icon.btn-danger:hover {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

/* Event Content */
.event-content {
    margin-bottom: 1.5rem;
}

.assignments-section {
    margin-bottom: 1rem;
}

.assignments-title {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}

.assignments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

.assignment-item {
    background: #f8f9ff;
    border: 1px solid #e3e6f0;
    border-radius: 8px;
    padding: 0.75rem;
    transition: all 0.2s ease;
}

.assignment-item:hover {
    border-color: #667eea;
    background: #f0f2ff;
}

.assignment-type {
    font-size: 0.85rem;
    color: #667eea;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.assignment-cantor {
    font-size: 0.9rem;
    color: #333;
    font-weight: 500;
}

.assignment-item.more-assignments {
    background: #fff3cd;
    border-color: #ffeaa7;
}

.assignment-item.more-assignments .assignment-type {
    color: #856404;
}

.assignment-item.more-assignments .assignment-cantor {
    color: #856404;
}

.no-assignments {
    background: #f8f9ff;
    border: 1px dashed #c5d0eb;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    color: #666;
    font-style: italic;
}

.event-footer {
    border-top: 1px solid #f0f0f0;
    padding-top: 1rem;
    text-align: center;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 0;
}

.empty-icon {
    width: 100px;
    height: 100px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    border-radius: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 2rem;
    font-size: 2.5rem;
    color: white;
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.3);
}

.empty-state h3 {
    color: #333;
    font-size: 1.8rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.empty-state p {
    color: #666;
    font-size: 1.1rem;
    margin-bottom: 2rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* Modern Button Styles */
.btn-modern {
    padding: 0.875rem 2rem;
    font-size: 1rem;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: none;
    position: relative;
    z-index: 2;
}

.btn-primary.btn-modern {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
}

.btn-primary.btn-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    color: white;
}

/* Modal Updates */
.modal {
    --bs-modal-zindex: 1055;
}

.modal-backdrop {
    --bs-backdrop-zindex: 1050;
}

.modal-dialog {
    direction: rtl;
}

.modal-header {
    display: flex;
    flex-direction: row-reverse;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e3e6f0;
}

.modal-header .btn-close {
    margin: 0;
    padding: 0.5rem;
}

.modal-content {
    border-radius: 16px;
    border: none;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #e3e6f0;
    padding: 0.75rem 1rem;
}

.form-control:focus, .form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* Hebrew RTL dropdown arrow positioning */
.form-select {
    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='m1 6 7 7 7-7'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: left 0.75rem center;
    background-size: 16px 12px;
    padding-left: 2.25rem;
    padding-right: 0.75rem;
}

/* Override Bootstrap's default right positioning */
.form-select:not([multiple]):not([size]) {
    background-position: left 0.75rem center;
}

/* Responsive Design */
@media (max-width: 768px) {
    .page-title {
        font-size: 2rem;
    }

    .events-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .event-card {
        padding: 1rem;
    }

    .event-header {
        flex-direction: column;
        gap: 1rem;
    }

    .event-actions {
        align-self: flex-end;
    }

    .assignments-grid {
        grid-template-columns: 1fr;
    }

    .content-container {
        padding: 0 0.5rem;
    }
}

@media (max-width: 480px) {
    .page-header {
        padding: 1.5rem 0;
    }

    .page-title {
        font-size: 1.8rem;
    }

    .date-badges {
        gap: 0.25rem;
    }

    .event-date-badge {
        font-size: 1.2rem;
        padding: 0.5rem;
        min-width: 60px;
    }

    .hebrew-date-badge {
        font-size: 0.75rem;
        padding: 0.3rem 0.5rem;
        min-width: 60px;
    }
}

/* Z-index fix for cantor history modal to appear above edit modal */
.cantor-history-modal {
    z-index: 1060 !important;
}

.cantor-history-backdrop {
    z-index: 1059 !important;
}

/* Enhanced Cantor Suggestion Styles */
.cantor-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    background: #fff;
}

.cantor-item {
    padding: 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #f8f9fa;
    transition: background-color 0.15s ease-in-out;
    direction: rtl;
    text-align: right;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-direction: row-reverse;
}

.cantor-item:last-child {
    border-bottom: none;
}

.cantor-item:hover {
    background-color: #f8f9fa;
}

.cantor-item.selected {
    background-color: #0d6efd;
    color: white;
}

.cantor-item.special-occasion {
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
}

.cantor-item.special-occasion.selected {
    background-color: #0d6efd;
    border-left-color: #fff;
}

.cantor-item .cantor-name {
    flex: 1;
    text-align: right;
    font-weight: 500;
}

.cantor-item .cantor-icons {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-right: 0.5rem;
    font-size: 1.1em;
}

.modal-dialog {
    max-width: 600px;
}

/* Drag and Drop Styles */
.drag-handle {
    cursor: grab;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.drag-handle:hover {
    opacity: 1;
    color: #007bff !important;
}

tr[draggable="true"] {
    transition: all 0.2s ease;
}

tr[draggable="true"]:hover .drag-handle {
    opacity: 1;
    color: #007bff !important;
}

tr.dragging {
    opacity: 0.5;
    transform: scale(0.98);
    background-color: #f8f9fa;
}

tr.drop-target {
    border-top: 3px solid #007bff;
    background-color: #e3f2fd;
}

tbody tr[draggable="true"]:hover {
    background-color: #f8f9fa;
}
