/**
 * Entry Selector Modal Styles
 * @package Myavana_Hair_Journey
 * @version 1.0.0
 */

/* Modal Base */
#myavana-entry-selector-modal.myavana-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
}

#myavana-entry-selector-modal .myavana-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1;
}

#myavana-entry-selector-modal .myavana-modal-container {
    position: relative;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    z-index: 10; /* Above overlay */
    pointer-events: auto; /* Ensure clicks work */
}

/* Modal Header */
.myavana-modal-header {
    padding: 24px 32px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.myavana-modal-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: #1f2937;
}

.myavana-modal-close {
    background: none;
    border: none;
    font-size: 32px;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
}

.myavana-modal-close:hover {
    background: #f3f4f6;
    color: #1f2937;
}

/* Modal Body */
.myavana-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 32px;
    max-height: calc(90vh - 200px);
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Ensure modal body is scrollable */
.myavana-modal-body.is-overflow-y {
    overflow-y: auto !important;
}

/* Filters */
.entry-selector-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.entry-selector-filters .myavana-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
}

.entry-selector-filters .myavana-select {
    padding: 10px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    background: white;
}

.entry-selector-filters .checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #4b5563;
    cursor: pointer;
}

.entry-selector-filters .checkbox-label input[type="checkbox"] {
    cursor: pointer;
}

/* Selection Actions */
.entry-selector-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}

.entry-selector-actions .selected-count {
    margin-left: auto;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
}

/* Loading State */
.entry-selector-loading {
    text-align: center;
    padding: 60px 20px;
}

.entry-selector-loading .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f4f6;
    border-top-color: var(--myavana-coral, #e7a690);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

.entry-selector-loading p {
    color: #6b7280;
    font-size: 14px;
}
.is-overflow-y{
    overflow-y: scroll;
}
/* Empty State */
.entry-selector-empty {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

/* Entry Grid */
.entry-selector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    /* Remove overflow-y from grid, parent handles it */
}

/* Entry Card */
.entry-selector-card {
    position: relative;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    pointer-events: auto; /* Ensure clicks work */
}

.entry-selector-card:hover {
    border-color: var(--myavana-coral, #e7a690);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.entry-selector-card.selected {
    border-color: var(--myavana-coral, #e7a690);
    border-width: 3px;
    background: linear-gradient(to bottom, rgba(231, 166, 144, 0.05), #fff);
}

.entry-selector-card.already-shared {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f9fafb;
}

.entry-selector-card.already-shared:hover {
    transform: none;
    box-shadow: none;
}

/* Entry Thumbnail */
.entry-thumbnail {
    width: 100%;
    height: 200px;
    background-size: cover;
    background-position: center;
    background-color: #f3f4f6;
}

.entry-thumbnail.no-photo {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    opacity: 0.3;
}

/* Badges */
.shared-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #10b981;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    z-index: 2;
}

.photo-count {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    z-index: 2;
}

/* Card Content */
.entry-card-content {
    padding: 16px;
}

.entry-date {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 8px;
}

.entry-title {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 8px 0;
    line-height: 1.4;
}

.entry-notes {
    font-size: 14px;
    color: #4b5563;
    margin: 0;
    line-height: 1.5;
}

.entry-meta {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.entry-health,
.entry-mood {
    font-size: 13px;
    color: #6b7280;
}

/* Card Actions */
.entry-card-actions {
    padding: 12px 16px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.preview-entry-btn {
    background: none;
    border: none;
    color: var(--myavana-coral, #e7a690);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.2s;
}

.preview-entry-btn:hover {
    background: rgba(231, 166, 144, 0.1);
}

.selection-indicator {
    width: 24px;
    height: 24px;
    border: 2px solid #d1d5db;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: transparent;
    transition: all 0.2s;
}

.entry-selector-card.selected .selection-indicator {
    background: var(--myavana-coral, #e7a690);
    border-color: var(--myavana-coral, #e7a690);
    color: white;
}

/* Modal Footer */
.myavana-modal-footer {
    padding: 20px 32px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.privacy-selector {
    display: flex;
    align-items: center;
    gap: 12px;
}

.privacy-selector label {
    font-size: 14px;
    font-weight: 500;
    color: #4b5563;
}

.privacy-selector .myavana-select {
    padding: 8px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
}

.myavana-btn-secondary {
    background: #f3f4f6;
    color: #4b5563;
    border: 1px solid #d1d5db;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.myavana-btn-secondary:hover {
    background: #e5e7eb;
}

.myavana-btn {
    background: var(--myavana-coral, #e7a690);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.myavana-btn:hover {
    background: #d89580;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(231, 166, 144, 0.3);
}

.myavana-btn:disabled {
    background: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.myavana-btn .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 8px;
    vertical-align: middle;
}

/* Toast Notifications */
.myavana-toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: #10b981;
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    font-size: 14px;
    font-weight: 500;
    z-index: 10001;
    transition: bottom 0.3s ease;
}

.myavana-toast.show {
    bottom: 24px;
}

.myavana-toast.success {
    background: #10b981;
}

.myavana-toast.error {
    background: #ef4444;
}

/* Responsive */
@media (max-width: 768px) {
    #myavana-entry-selector-modal .myavana-modal-container {
        width: 95%;
        max-height: 95vh;
    }

    .myavana-modal-header {
        padding: 16px 20px;
    }

    .myavana-modal-header h2 {
        font-size: 20px;
    }

    .myavana-modal-body {
        padding: 16px 20px;
    }

    .entry-selector-filters {
        flex-direction: column;
    }

    .entry-selector-filters .myavana-input {
        width: 100%;
    }

    .entry-selector-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .myavana-modal-footer {
        flex-direction: column;
        padding: 16px 20px;
    }

    .privacy-selector {
        width: 100%;
        justify-content: space-between;
    }

    .myavana-modal-footer .myavana-btn,
    .myavana-modal-footer .myavana-btn-secondary {
        width: 100%;
    }
}

/* Accessibility */
.entry-selector-card:focus {
    outline: 2px solid var(--myavana-coral, #e7a690);
    outline-offset: 2px;
}

button:focus {
    outline: 2px solid var(--myavana-coral, #e7a690);
    outline-offset: 2px;
}
