/* Tohed Members — Notes Button (Icon Only) */

button.tm-notes-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 40px;
    height: 40px;
    padding: 0;

    border: none;
    border-radius: 8px;

    cursor: pointer;
    position: relative;

    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);

    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);

    -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none;
    appearance: none;

    margin-left: 8px; /* Gap from bookmark button */
    box-sizing: border-box;
}

button.tm-notes-icon-btn svg {
    width: 22px;
    height: 22px;

    display: block;

    fill: none;
    stroke: #4DD0E1; /* Bright teal - stands out on brown */
    stroke-width: 2.5px;

    transition: all 0.3s ease;
    filter: drop-shadow(0 0 4px rgba(77, 208, 225, 0.3));
}

button.tm-notes-icon-btn:hover {
    background: rgba(77, 208, 225, 0.15);
    transform: translateY(-2px) scale(1.05);
}

button.tm-notes-icon-btn:hover svg {
    stroke: #26C6DA;
    filter: drop-shadow(0 0 8px rgba(38, 198, 218, 0.5));
    transform: scale(1.1);
}

button.tm-notes-icon-btn:active {
    transform: translateY(0) scale(1);
}

/* Guest State - Muted Gray */
button.tm-notes-icon-btn.is-guest svg {
    stroke: #B0BEC5;
    filter: drop-shadow(0 0 2px rgba(176, 190, 197, 0.2));
}

button.tm-notes-icon-btn.is-guest:hover {
    background: rgba(176, 190, 197, 0.12);
}

button.tm-notes-icon-btn.is-guest:hover svg {
    stroke: #CFD8DC;
}

/* Has Notes State - Bright Teal + Count Badge */
button.tm-notes-icon-btn.has-notes svg {
    stroke: #00BCD4;
    filter: drop-shadow(0 0 6px rgba(0, 188, 212, 0.6));
    animation: notePulse 2s ease-in-out infinite;
}

button.tm-notes-icon-btn.has-notes:hover {
    background: rgba(0, 188, 212, 0.15);
}

button.tm-notes-icon-btn.has-notes:hover svg {
    stroke: #00ACC1;
    filter: drop-shadow(0 0 10px rgba(0, 172, 193, 0.7));
}

@keyframes notePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

/* Count Badge */
button.tm-notes-icon-btn.has-notes::after {
    content: attr(data-count);
    position: absolute;
    top: -4px;
    left: -4px;

    background: linear-gradient(135deg, #FF6B6B 0%, #EE5A6F 100%);
    color: #fff;

    font-size: 0.7rem;
    font-weight: 700;

    min-width: 18px;
    height: 18px;
    border-radius: 9px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0 4px;
    box-shadow: 0 2px 6px rgba(238, 90, 111, 0.4);

    animation: badgePop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes badgePop {
    0% { transform: scale(0); }
    100% { transform: scale(1); }
}

/* Tooltip */
button.tm-notes-icon-btn::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: -40px;
    right: 50%;
    transform: translateX(50%);

    background: rgba(0, 0, 0, 0.9);
    color: #fff;

    padding: 6px 12px;
    border-radius: 6px;

    font-size: 0.85rem;
    white-space: nowrap;

    opacity: 0;
    pointer-events: none;

    transition: opacity 0.3s ease;
    z-index: 1000;
    font-weight: 500;
}

button.tm-notes-icon-btn:hover::before {
    opacity: 1;
}

/* Modal */
.tm-notes-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;

    background: rgba(0,0,0,0.75);
    z-index: 999999;

    align-items: center;
    justify-content: center;

    padding: 20px;
    backdrop-filter: blur(5px);
}

.tm-notes-modal.is-open {
    display: flex;
}

.tm-notes-modal-content {
    background: #fff;
    border-radius: 16px;

    max-width: 600px;
    width: 100%;

    max-height: 90vh;
    overflow-y: auto;

    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease;

    direction: rtl;
}

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

/* Modal Header */
.tm-notes-modal-header {
    background: linear-gradient(135deg, #00BCD4 0%, #00ACC1 100%);
    color: #fff;

    padding: 20px 24px;
    border-radius: 16px 16px 0 0;

    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tm-notes-modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
}

.tm-notes-modal-close {
    background: transparent;
    border: none;
    color: #fff;

    font-size: 1.8rem;
    cursor: pointer;

    padding: 0;
    width: 32px;
    height: 32px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;
    transition: background 0.2s;
}

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

.tm-notes-modal-body {
    padding: 24px;
}

.tm-notes-field {
    margin-bottom: 20px;
}

.tm-notes-label {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;

    color: #5D4E37;
    margin-bottom: 8px;
}

.tm-notes-textarea,
.tm-notes-select {
    width: 100%;
    padding: 12px 16px;

    font-size: 1rem;
    font-family: inherit;

    border: 2px solid #E8DCC8;
    border-radius: 10px;

    background: #FAFAF8;
    color: #5D4E37;

    transition: all 0.2s ease;
    box-sizing: border-box;
}

.tm-notes-textarea {
    min-height: 150px;
    resize: vertical;
    line-height: 1.6;
}

.tm-notes-textarea:focus,
.tm-notes-select:focus {
    outline: none;
    border-color: #00BCD4;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0,188,212,0.1);
}

.tm-notes-hint {
    font-size: 0.85rem;
    color: #8B7355;
    margin-top: 6px;
}

.tm-notes-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

.tm-notes-btn-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    padding: 12px 24px;

    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;

    border: none;
    border-radius: 10px;

    cursor: pointer;
    transition: all 0.3s ease;
}

.tm-notes-btn-save {
    background: linear-gradient(135deg, #00BCD4 0%, #00ACC1 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(0,188,212,0.25);
}

.tm-notes-btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,188,212,0.35);
}

.tm-notes-btn-cancel {
    background: #fff;
    color: #5D4E37;
    border: 2px solid #E8DCC8;
}

.tm-notes-btn-cancel:hover {
    border-color: #8B6914;
    color: #8B6914;
}

.tm-notes-btn-action.is-loading {
    opacity: 0.7;
    cursor: wait;
}

/* Linked content info */
.tm-notes-content-info {
    background: linear-gradient(135deg, #FFF8E1 0%, #FFECB3 100%);
    border: 1px solid #FFE082;
    border-radius: 10px;

    padding: 12px 16px;
    margin-bottom: 20px;

    font-size: 0.9rem;
    color: #8B6914;
}

.tm-notes-content-info svg {
    width: 16px;
    height: 16px;
    display: inline;
    vertical-align: middle;
    margin-left: 6px;
}

/* Mobile */
@media (max-width: 600px) {
    button.tm-notes-icon-btn {
        width: 36px;
        height: 36px;
        margin-left: 6px;
    }

    button.tm-notes-icon-btn svg {
        width: 20px;
        height: 20px;
    }

    .tm-notes-modal-content {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .tm-notes-modal-header {
        border-radius: 0;
    }

    .tm-notes-actions {
        flex-direction: column-reverse;
    }

    .tm-notes-btn-action {
        width: 100%;
    }
}
