/**
 * Nutri AI Contextual Actions Styles
 * Modal styles for add to plan, add to list, and favorites
 *
 * @package Nutri_AI
 */

/* ========================================
   MODAL BASE STYLES
   ======================================== */

.na-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.na-modal.active {
    display: flex;
    opacity: 1;
}

.na-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.80);
    backdrop-filter: blur(8px);
}

.na-modal-content {
    position: relative;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    background: rgba(15, 23, 42, 0.98);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 24px;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: na-modal-scale-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes na-modal-scale-in {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.na-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.20);
    background: rgba(2, 6, 23, 0.60);
    color: #cbd5e1;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 1;
    line-height: 1;
}

.na-modal-close:hover {
    background: rgba(239, 68, 68, 0.20);
    border-color: rgba(239, 68, 68, 0.40);
    color: #ef4444;
    transform: rotate(90deg);
}

.na-modal-header {
    padding: 28px 28px 20px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.na-modal-title {
    margin: 0;
    color: #e2e8f0;
    font-size: 22px;
    font-weight: 800;
    line-height: 1.2;
}

.na-modal-body {
    padding: 24px 28px;
    overflow-y: auto;
    flex: 1;
}

.na-modal-body::-webkit-scrollbar {
    width: 8px;
}

.na-modal-body::-webkit-scrollbar-track {
    background: rgba(2, 6, 23, 0.25);
}

.na-modal-body::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.30);
    border-radius: 4px;
}

.na-modal-footer {
    display: flex;
    gap: 12px;
    padding: 20px 28px 28px;
    justify-content: flex-end;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.na-modal-footer .na-btn {
    min-width: 120px;
}

/* ========================================
   FORM ELEMENTS
   ======================================== */

.na-form-group {
    margin-bottom: 24px;
}

.na-form-group:last-child {
    margin-bottom: 0;
}

.na-label {
    display: block;
    margin-bottom: 10px;
    color: rgba(226, 232, 240, 0.90);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.na-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 12px;
    background: rgba(2, 6, 23, 0.40);
    color: #e2e8f0;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.2s ease;
}

.na-input:focus {
    outline: none;
    border-color: rgba(67, 200, 72, 0.50);
    background: rgba(2, 6, 23, 0.60);
    box-shadow: 0 0 0 3px rgba(67, 200, 72, 0.12);
}

.na-input::placeholder {
    color: rgba(203, 213, 225, 0.50);
}

/* ========================================
   MEAL TYPE SELECTOR
   ======================================== */

.na-meal-type-selector {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.na-meal-type-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    border: 2px solid rgba(148, 163, 184, 0.20);
    border-radius: 16px;
    background: rgba(2, 6, 23, 0.30);
    color: rgba(203, 213, 225, 0.85);
    cursor: pointer;
    transition: all 0.25s ease;
    font-size: 14px;
    font-weight: 600;
}

.na-meal-type-btn:hover {
    border-color: rgba(67, 200, 72, 0.40);
    background: rgba(67, 200, 72, 0.08);
    transform: translateY(-2px);
}

.na-meal-type-btn.active {
    border-color: rgba(67, 200, 72, 0.60);
    background: rgba(67, 200, 72, 0.15);
    color: #43C848;
    box-shadow: 0 4px 16px rgba(67, 200, 72, 0.25);
}

.na-meal-icon {
    font-size: 32px;
    line-height: 1;
}

.na-meal-label {
    font-size: 13px;
    font-weight: 700;
    text-align: center;
}

/* ========================================
   EXISTING MEAL WARNING
   ======================================== */

.na-existing-meal-warning {
    margin-top: 20px;
    animation: na-slide-down 0.3s ease;
}

@keyframes na-slide-down {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.na-warning-box {
    display: flex;
    gap: 14px;
    padding: 16px;
    border: 1px solid rgba(251, 146, 60, 0.40);
    border-radius: 14px;
    background: rgba(251, 146, 60, 0.10);
}

.na-warning-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.na-warning-content {
    flex: 1;
}

.na-warning-title {
    margin: 0 0 6px;
    color: #fb923c;
    font-size: 15px;
    font-weight: 700;
}

.na-warning-text {
    margin: 0 0 12px;
    color: rgba(203, 213, 225, 0.85);
    font-size: 14px;
    line-height: 1.5;
}

.na-existing-meal-preview {
    margin-bottom: 14px;
    padding: 12px;
    border-radius: 10px;
    background: rgba(2, 6, 23, 0.40);
    border: 1px solid rgba(148, 163, 184, 0.15);
}

.na-meal-preview strong {
    display: block;
    margin-bottom: 4px;
    color: #e2e8f0;
    font-size: 14px;
}

.na-meal-meta {
    color: rgba(203, 213, 225, 0.70);
    font-size: 13px;
}

/* ========================================
   CHECKBOX
   ======================================== */

.na-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    cursor: pointer;
    color: rgba(203, 213, 225, 0.90);
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s ease;
    user-select: none;
}

.na-checkbox-label:hover {
    color: #e2e8f0;
}

.na-checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(148, 163, 184, 0.40);
    border-radius: 6px;
    background: rgba(2, 6, 23, 0.40);
    cursor: pointer;
    appearance: none;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.na-checkbox-label input[type="checkbox"]:checked {
    background: #43C848;
    border-color: #43C848;
}

.na-checkbox-label input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
}

.na-checkbox-label input[type="checkbox"]:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(67, 200, 72, 0.20);
}

/* ========================================
   INGREDIENTS CHECKLIST
   ======================================== */

.na-ingredients-checklist {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
    padding: 12px;
    border-radius: 12px;
    background: rgba(2, 6, 23, 0.25);
    border: 1px solid rgba(148, 163, 184, 0.12);
}

.na-ingredients-checklist::-webkit-scrollbar {
    width: 6px;
}

.na-ingredients-checklist::-webkit-scrollbar-track {
    background: rgba(2, 6, 23, 0.20);
}

.na-ingredients-checklist::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.30);
    border-radius: 3px;
}

.na-ingredient-item {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}

.na-ingredient-item:last-child {
    border-bottom: none;
}

.na-ingredient-select-all {
    padding: 12px;
    margin-bottom: 8px;
    border-bottom: 2px solid rgba(148, 163, 184, 0.15);
    font-weight: 700;
    color: #43C848;
}

.na-no-ingredients {
    padding: 40px 20px;
    text-align: center;
    color: rgba(203, 213, 225, 0.60);
    font-size: 14px;
}

/* ========================================
   ACTION BUTTONS ON CARDS
   ======================================== */

.na-meal-card-actions,
.na-recipe-card-actions {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.na-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.20);
    background: rgba(2, 6, 23, 0.40);
    color: rgba(203, 213, 225, 0.80);
    cursor: pointer;
    transition: all 0.2s ease;
}

.na-action-btn:hover {
    background: rgba(67, 200, 72, 0.15);
    border-color: rgba(67, 200, 72, 0.40);
    color: #43C848;
    transform: translateY(-2px) scale(1.05);
}

.na-action-btn svg {
    width: 18px;
    height: 18px;
}

.na-action-btn.is-favorite {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.40);
    color: #ef4444;
}

.na-action-btn.is-favorite svg {
    fill: currentColor;
}

/* ========================================
   AI MEAL CARD (in chat)
   ======================================== */

.na-ai-meal-card {
    margin-top: 16px;
    border: 1px solid rgba(67, 200, 72, 0.25);
    border-radius: 16px;
    background: rgba(67, 200, 72, 0.08);
    overflow: hidden;
    animation: na-fade-in 0.4s ease;
}

.na-meal-card-content {
    padding: 16px;
}

.na-meal-card-title {
    margin: 0 0 10px;
    color: #e2e8f0;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
}

.na-meal-card-description {
    margin: 0 0 12px;
    color: rgba(203, 213, 225, 0.85);
    font-size: 14px;
    line-height: 1.5;
}

.na-meal-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.na-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
    color: rgba(203, 213, 225, 0.80);
    font-size: 13px;
    font-weight: 600;
}

.na-meta-icon {
    font-size: 14px;
}

/* ========================================
   INGREDIENT COUNT BADGE
   ======================================== */

.na-ingredient-count {
    display: inline-block;
    min-width: 20px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(67, 200, 72, 0.25);
    color: #43C848;
    font-weight: 800;
    font-size: 13px;
    line-height: 1;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .na-modal-content {
        max-width: 100%;
        margin: 0 10px;
        max-height: 95vh;
    }

    .na-modal-header,
    .na-modal-body,
    .na-modal-footer {
        padding-left: 20px;
        padding-right: 20px;
    }

    .na-modal-close {
        top: 16px;
        right: 16px;
        width: 36px;
        height: 36px;
    }

    .na-meal-type-selector {
        grid-template-columns: 1fr;
    }

    .na-modal-footer {
        flex-direction: column;
    }

    .na-modal-footer .na-btn {
        width: 100%;
    }

    .na-meal-card-actions,
    .na-recipe-card-actions {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .na-meal-type-btn {
        padding: 14px 10px;
    }

    .na-meal-icon {
        font-size: 28px;
    }

    .na-meal-label {
        font-size: 12px;
    }
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes na-fade-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   BUTTON UTILITIES
   ======================================== */

.na-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
}

.na-btn-primary {
    background: linear-gradient(135deg, #43C848 0%, #36a83d 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(67, 200, 72, 0.35);
}

.na-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(67, 200, 72, 0.45);
}

.na-btn-primary:active {
    transform: translateY(0);
}

.na-btn-secondary {
    background: rgba(148, 163, 184, 0.15);
    color: rgba(226, 232, 240, 0.90);
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.na-btn-secondary:hover {
    background: rgba(148, 163, 184, 0.25);
    border-color: rgba(148, 163, 184, 0.40);
}

.na-btn:disabled,
.na-btn.na-loading {
    opacity: 0.6;
    pointer-events: none;
}
