/* Family Calendar Custom Styles */

body {
    background-color: #f8f9fa;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
}

.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
}

/* Mobile-first approach for navbar */
@media (max-width: 991px) {
    .navbar-brand {
        font-size: 1.2rem;
    }
    
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .navbar-text {
        display: block !important;
        padding: 0.5rem 1rem;
        margin: 0 !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
}

.calendar-grid {
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-bottom: 2rem;
}

.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.day-header {
    padding: 15px 10px;
    text-align: center;
    color: white;
    font-weight: bold;
    font-size: 0.9rem;
}

.calendar-body {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background-color: #e9ecef;
}

/* Touch-friendly improvements */
.calendar-day {
    background: white;
    min-height: 120px;
    padding: 8px;
    position: relative;
    transition: background-color 0.2s ease;
    border: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(102, 126, 234, 0.1);
    touch-action: manipulation;
}

.calendar-day:hover, .calendar-day:focus {
    background-color: #f8f9fa;
    outline: none;
}

.calendar-day:active {
    background-color: #e9ecef;
    transform: scale(0.98);
}

.calendar-day:hover {
    background-color: #f8f9fa;
}

.calendar-day.empty {
    background-color: #f8f9fa;
}

.calendar-day.today {
    background-color: #fff3cd;
    border: 2px solid #ffc107;
}

.calendar-day.has-events {
    background-color: #e7f3ff;
}

.day-number {
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 5px;
    color: #333;
}

/* Event styling with touch improvements */
.event {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 2px 6px;
    margin: 2px 0;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    word-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.3);
    touch-action: manipulation;
    min-height: 20px;
    display: flex;
    align-items: center;
}

.event:hover, .event:focus {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    outline: none;
}

.event-birthday_event:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 8px rgba(233, 30, 99, 0.4);
}

.event-anniversary_event:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 8px rgba(255, 107, 107, 0.4);
}

.event:active {
    transform: translateY(0) scale(0.98);
}

.event-jewish_holiday {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.event-us_federal_holiday {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
}

.event-additional_holiday {
    background: linear-gradient(135deg, #feca57 0%, #ff9ff3 100%);
    color: #333;
}

.event-birthday_event {
    background: linear-gradient(135deg, #ff9ff3 0%, #f368e0 100%);
    border: 1px solid #e91e63;
    box-shadow: 0 2px 4px rgba(233, 30, 99, 0.3);
}

.event-anniversary_event {
    background: linear-gradient(135deg, #ffd89b 0%, #ff9a9e 100%);
    border: 1px solid #ff6b6b;
    box-shadow: 0 2px 4px rgba(255, 107, 107, 0.3);
    color: #333;
}

/* Event indicator styles for admin interface */
.event-indicator {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid;
}

.event-indicator.event-birthday_event {
    background: linear-gradient(135deg, #ff9ff3 0%, #f368e0 100%);
    border-color: #e91e63;
}

.event-indicator.event-anniversary_event {
    background: linear-gradient(135deg, #ffd89b 0%, #ff9a9e 100%);
    border-color: #ff6b6b;
}

/* Badge styles */
.bg-pink {
    background-color: #e91e63 !important;
}

.bg-orange {
    background-color: #ff6b6b !important;
}

.event-personal_event {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.event-birthday {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.event-anniversary {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
}

.event-family {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    color: #333;
}

.event-title {
    font-weight: 500;
    line-height: 1.2;
    word-wrap: break-word;
}

.event-sticker {
    width: 20px;
    height: 20px;
    position: absolute;
    top: 2px;
    right: 2px;
    border-radius: 2px;
}

.month-header {
    color: #495057;
    font-weight: 300;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    padding-bottom: 15px;
}

.month-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 3px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
}

.month-calendar {
    scroll-margin-top: 100px;
}

/* Modal Styles */
.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom: none;
}

.modal-header .btn-close {
    filter: invert(1);
}

/* Cards */
.card {
    border: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

.card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom: none;
    border-radius: 10px 10px 0 0 !important;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    transform: translateY(-1px);
}

.btn-outline-primary {
    border-color: #667eea;
    color: #667eea;
}

.btn-outline-primary:hover {
    background: #667eea;
    border-color: #667eea;
}

/* Alerts */
.alert {
    border-radius: 10px;
    border: none;
}

/* Form Controls */
.form-control, .form-select {
    border-radius: 8px;
    border: 2px solid #e9ecef;
    transition: border-color 0.2s ease;
}

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

/* Responsive Design - Enhanced for Mobile and Tablets */

/* Large Tablets and Small Desktops */
@media (max-width: 1200px) {
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .calendar-day {
        min-height: 100px;
        padding: 6px;
    }
    
    .day-number {
        font-size: 1rem;
    }
    
    .event {
        font-size: 0.7rem;
        padding: 2px 5px;
        margin: 1px 0;
    }
}

/* Tablets */
@media (max-width: 992px) {
    .display-4 {
        font-size: 2.5rem;
    }
    
    .calendar-day {
        min-height: 90px;
        padding: 5px;
    }
    
    .day-header {
        padding: 12px 8px;
        font-size: 0.85rem;
    }
    
    .event {
        font-size: 0.65rem;
        padding: 1px 4px;
    }
    
    /* Stack navigation elements vertically on tablets */
    .d-flex.justify-content-between.align-items-center {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .d-flex.justify-content-between.align-items-center h1 {
        text-align: center;
        margin-bottom: 0;
    }
    
    .btn-group {
        justify-content: center;
    }
}

/* Small Tablets and Large Phones */
@media (max-width: 768px) {
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    .display-4 {
        font-size: 2rem;
        text-align: center;
    }
    
    .calendar-day {
        min-height: 80px;
        padding: 4px;
        font-size: 0.9rem;
    }
    
    .day-number {
        font-size: 0.95rem;
        margin-bottom: 3px;
    }
    
    .event {
        font-size: 0.6rem;
        padding: 1px 3px;
        margin: 1px 0;
        line-height: 1.2;
    }
    
    .event-sticker {
        width: 14px;
        height: 14px;
    }
    
    /* Make year/month selectors stack vertically */
    .row.mb-4 .col-md-6 {
        margin-bottom: 1rem;
    }
    
    /* Adjust button sizes */
    .btn {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }
    
    .btn-group .btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    
    /* Make modals more mobile-friendly */
    .modal-dialog {
        margin: 0.5rem;
        max-width: none;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    /* Form improvements for mobile */
    .form-control, .form-select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.75rem;
    }
    
    .input-group-text {
        font-size: 0.9rem;
        padding: 0.75rem;
    }
}

/* Phones */
@media (max-width: 576px) {
    body {
        font-size: 0.9rem;
    }
    
    .container {
        padding-left: 8px;
        padding-right: 8px;
    }
    
    .display-4 {
        font-size: 1.75rem;
        margin-bottom: 1rem;
    }
    
    .calendar-day {
        min-height: 70px;
        padding: 3px;
        font-size: 0.85rem;
    }
    
    .day-header {
        padding: 8px 4px;
        font-size: 0.75rem;
    }
    
    .day-number {
        font-size: 0.9rem;
        margin-bottom: 2px;
    }
    
    .event {
        font-size: 0.55rem;
        padding: 1px 2px;
        margin: 0.5px 0;
        border-radius: 2px;
    }
    
    .event-sticker {
        width: 12px;
        height: 12px;
        top: 1px;
        right: 1px;
    }
    
    /* Navigation improvements for mobile */
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .nav-link {
        font-size: 0.9rem;
    }
    
    /* Button improvements */
    .btn {
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
    }
    
    .btn-group {
        display: flex;
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    .btn-group .btn {
        flex: 1;
        font-size: 0.75rem;
        padding: 0.35rem 0.6rem;
        margin-bottom: 0.25rem;
    }
    
    /* Form control improvements */
    .input-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .input-group-text {
        border-radius: 0.375rem 0.375rem 0 0 !important;
        text-align: center;
        font-weight: 500;
    }
    
    .form-select, .form-control {
        border-radius: 0 0 0.375rem 0.375rem !important;
        margin-top: -1px;
    }
    
    /* Modal improvements for small screens */
    .modal-header {
        padding: 0.75rem;
    }
    
    .modal-title {
        font-size: 1.1rem;
    }
    
    .modal-body {
        padding: 0.75rem;
    }
    
    .modal-footer {
        padding: 0.75rem;
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
        margin: 0.25rem 0;
    }
    
    /* Footer adjustments */
    footer {
        margin-top: 2rem !important;
        padding: 1.5rem 0 !important;
    }
    
    footer p {
        font-size: 0.85rem;
        margin-bottom: 0;
    }
}

/* Extra Small Phones */
@media (max-width: 400px) {
    .calendar-day {
        min-height: 60px;
        padding: 2px;
    }
    
    .day-header {
        padding: 6px 2px;
        font-size: 0.7rem;
    }
    
    .day-number {
        font-size: 0.85rem;
    }
    
    .event {
        font-size: 0.5rem;
        padding: 1px;
        line-height: 1.1;
    }
    
    .display-4 {
        font-size: 1.5rem;
    }
    
    .navbar-brand {
        font-size: 1rem;
    }
    
    .btn-group .btn {
        font-size: 0.7rem;
        padding: 0.3rem 0.5rem;
    }
}

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

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

/* Scroll to top button - Enhanced for mobile */
.scroll-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s ease;
    border: none;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.scroll-top:hover, .scroll-top:focus {
    opacity: 0.8;
    transform: scale(1.1);
    outline: none;
}

.scroll-top:active {
    transform: scale(0.95);
}

@media (max-width: 768px) {
    .scroll-top {
        bottom: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
    }
}

@media (max-width: 576px) {
    .scroll-top {
        bottom: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
    }
}

/* Mobile-specific utility classes */
@media (max-width: 768px) {
    .mobile-stack {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    
    .mobile-center {
        text-align: center !important;
    }
    
    .mobile-full-width {
        width: 100% !important;
        margin-bottom: 0.5rem;
    }
    
    .mobile-hidden {
        display: none !important;
    }
    
    .mobile-text-small {
        font-size: 0.85rem !important;
    }
}

/* Improve table responsiveness for directory pages */
@media (max-width: 768px) {
    .table-responsive {
        border: none;
    }
    
    .table th, .table td {
        padding: 0.5rem 0.25rem;
        font-size: 0.9rem;
        vertical-align: middle;
    }
    
    .table th {
        border-top: none;
        font-size: 0.85rem;
        font-weight: 600;
    }
}

/* Enhanced card responsiveness */
@media (max-width: 768px) {
    .card {
        margin-bottom: 1rem;
        border-radius: 8px;
    }
    
    .card-header {
        padding: 0.75rem;
        font-size: 1rem;
        border-radius: 8px 8px 0 0 !important;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    .card-title {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .btn,
    .modal,
    .alert {
        display: none !important;
    }
    
    body {
        background: white;
    }
    
    .calendar-grid {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .calendar-day {
        border: 1px solid #ccc;
    }
}
