/**
 * ==============================================
 * MODAL COMPONENT - Reusable Styles
 * ==============================================
 * 
 * Base modal system for all modal types:
 * - Calendar modal
 * - Photo gallery modal
 * - Notification modal
 * - Filter modal
 * - And more...
 * 
 * Usage: Add .modal class + specific variant class
 */

/* ==============================================
   BASE MODAL OVERLAY
   ============================================== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    overflow: hidden;
    align-items: center;
    justify-content: center;
}

.modal.visible,
.modal.active {
    display: flex;
}

/* ==============================================
   MODAL CONTENT CONTAINER
   ============================================== */

.modal-content {
    background: var(--bg-elevated);
    border-radius: 16px;
    max-width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ==============================================
   MODAL HEADER
   ============================================== */

.modal-header {
    background: var(--bg-elevated);
    border-bottom: 2px solid var(--border-color);
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-header h2,
.modal-header h3 {
    font-size: 1.5rem;
    color: var(--text-dark);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.8rem;
    color: var(--text-light);
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.modal-close:hover {
    background: var(--bg-light);
    color: var(--text-dark);
}

/* ==============================================
   MODAL BODY
   ============================================== */

.modal-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

/* ==============================================
   MODAL FOOTER
   ============================================== */

.modal-footer {
    background: var(--bg-elevated);
    border-top: 1px solid var(--border-color);
    padding: 20px 30px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

/* ==============================================
   MODAL SIZES
   ============================================== */

/* Small modal (notifications) */
.modal-small .modal-content {
    max-width: 500px;
}

/* Medium modal (default) */
.modal-medium .modal-content {
    max-width: 800px;
}

/* Large modal (calendar, forms) */
.modal-large .modal-content {
    max-width: 1400px;
}

/* Full screen modal (photo gallery) */
.modal-fullscreen .modal-content {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
}

/* ==============================================
   NOTIFICATION MODAL (specific variant)
   ============================================== */

.notification-modal {
    /* Inherits from .modal */
}

.notification-modal .modal-header {
    background: linear-gradient(135deg, #c4613c, #f0a67d);
    color: white;
    border-bottom: none;
}

.notification-modal .modal-header h3 {
    color: white;
}

.notification-modal .modal-close {
    color: white;
}

.notification-modal .modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.notification-modal .modal-body {
    text-align: center;
}

.notification-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.notification-icon i {
    color: var(--primary-color);
}

.notification-message {
    font-size: 1.1rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.notification-modal .modal-footer {
    text-align: center;
    justify-content: center;
    border-top: none;
}

.btn-notification-ok {
    background: linear-gradient(135deg, #c4613c, #dd7447);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-notification-ok:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(221, 116, 71, 0.3);
}

/* ==============================================
   PHOTO GALLERY MODAL (specific variant)
   ============================================== */

.photo-gallery-modal {
    background: rgba(0, 0, 0, 0.95);
}

.photo-gallery-modal .modal-content {
    background: transparent;
    box-shadow: none;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
}

.gallery-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
}

.gallery-counter {
    font-size: 1.1rem;
    font-weight: 600;
}

.gallery-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    font-size: 1.5rem;
    transition: all 0.2s ease;
}

.gallery-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.gallery-modal-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 80px 60px;
}

.gallery-main-image {
    max-width: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-main-image img {
    max-width: 100%;
    max-height: calc(100vh - 200px);
    object-fit: contain;
    border-radius: 8px;
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.gallery-nav:hover {
    background: white;
    transform: translateY(-50%) scale(1.1);
}

.gallery-prev {
    left: 20px;
}

.gallery-next {
    right: 20px;
}

.gallery-nav i {
    font-size: 1.5rem;
    color: #333;
}

.gallery-thumbnails {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    gap: 10px;
    overflow-x: auto;
    justify-content: center;
}

.gallery-thumbnail {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.gallery-thumbnail:hover {
    opacity: 1;
}

.gallery-thumbnail.active {
    opacity: 1;
    border-color: var(--primary-color);
}

/* ==============================================
   FILTER MODAL (rentals page)
   ============================================== */

.filter-modal {
    /* Inherits from .modal */
}

.filter-modal .modal-content {
    max-width: 600px;
}

/* ==============================================
   RESPONSIVE - MOBILE
   ============================================== */

@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 95vh;
        border-radius: 12px;
    }
    
    .modal-header {
        padding: 15px 20px;
    }
    
    .modal-header h2,
    .modal-header h3 {
        font-size: 1.2rem;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .modal-footer {
        padding: 15px 20px;
    }
    
    /* Photo gallery on mobile */
    .gallery-modal-header {
        padding: 15px 20px;
    }
    
    .gallery-modal-body {
        padding: 80px 20px 100px;
    }
    
    .gallery-nav {
        width: 40px;
        height: 40px;
    }
    
    .gallery-prev {
        left: 10px;
    }
    
    .gallery-next {
        right: 10px;
    }
    
    .gallery-thumbnail {
        width: 60px;
        height: 45px;
    }
}

/* ==============================================
   ACCESSIBILITY
   ============================================== */

.modal:focus {
    outline: none;
}

.modal-close:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Prevent body scroll when modal is open */
body.modal-open {
    overflow: hidden;
}

/* ==============================================
   NOTE: Dark mode styles in /css/dark-mode.css
   ============================================== */

