/* ========================================
   BASE STYLES
   ======================================== */
.page-feedback {
    text-align: center;
    margin: 20px auto;
    padding: 20px 15px;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    background-color: #f6f8fa;
    max-width: 1000px;
    box-sizing: border-box;
}

.theme-dark .page-feedback {
    background-color: #1e1e1e;
    border-color: #444;
}

.feedback-question {
    font-weight: bold;
    font-size: 1.05em;
    color: #555;
}

.theme-dark .feedback-question {
    color: #ccc;
}

/* ========================================
   THREE-COLUMN ULTRA-COMPACT LAYOUT
   ======================================== */
.feedback-three-column-layout {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    width: 100%;
    box-sizing: border-box;
}

.feedback-column-compact {
    text-align: left;
    display: flex;
    flex-direction: column;
    min-width: 0;
    box-sizing: border-box;
    flex: 1; /* All columns grow equally by default */
}

/* Set specific flex ratios to match original proportions */
.feedback-emoji-col {
    flex: 2; /* 20% equivalent */
}

.feedback-category-col {
    flex: 3; /* 30% equivalent */
}

.feedback-comment-col {
    flex: 5; /* 50% equivalent */
}

/* Make column content fill available height */
.feedback-emojis-ultra-compact,
.feedback-categories-text-only {
    flex: 1; /* Forces these containers to stretch */
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Distributes items evenly */
}

/* ========================================
   COLUMN 1: ULTRA-COMPACT EMOJI LIST
   ======================================== */
.feedback-emojis-ultra-compact {
    display: flex;
    flex-direction: column;
}

.feedback-emoji-mini {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0px 8px; /* Uniform padding */
    border: 1.5px solid transparent;
    border-radius: 4px;
    transition: all 0.2s ease;
    background: white;
    flex: 1; /* Makes all emojis equal height */
    min-height: 0; /* Prevents overflow */
}

.theme-dark .feedback-emoji-mini {
    background: #2d2d2d;
}

.emoji-icon-mini {
    font-size: 1.4em;
    display: block;
    line-height: 1;
    transition: all 0.2s ease;
    user-select: none;
    min-width: 28px;
}

.emoji-label-mini {
    font-size: 0.9em;
    color: #333;
    transition: color 0.2s ease;
    flex: 1;
}

.theme-dark .emoji-label-mini {
    color: #aaa;
}

/* Hover effects */
@media (hover: hover) and (pointer: fine) {
    .feedback-emoji-mini:hover {
        border-color: #2c844d;
        background-color: #f0fdf4;
        transform: translateX(2px);
    }

    .theme-dark .feedback-emoji-mini:hover {
        border-color: #5ddea3;
        background-color: #1a3a2a;
    }

    .feedback-emoji-mini:hover .emoji-label-mini {
        color: #2c844d;
        font-weight: 600;
    }

    .theme-dark .feedback-emoji-mini:hover .emoji-label-mini {
        color: #5ddea3;
    }
}

/* Selected state */
.feedback-emoji-mini.selected {
    border-color: #2c844d;
    background-color: #e6f7ed;
}

.theme-dark .feedback-emoji-mini.selected {
    border-color: #5ddea3;
    background-color: #1a3a2a;
}

.feedback-emoji-mini.selected .emoji-label-mini {
    color: #2c844d;
    font-weight: 700;
}

.theme-dark .feedback-emoji-mini.selected .emoji-label-mini {
    color: #5ddea3;
}

/* ========================================
   COLUMN 2: TEXT-ONLY CATEGORIES
   ======================================== */
.feedback-categories-text-only {
    display: flex;
    flex-direction: column;
}

.category-text-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0px 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
    border-radius: 0;
    margin: 0 !important;
    flex: 1;
    min-height: 0;
    position: relative;
}

/* Round corners only for first and last items */
.category-text-item:first-child {
    border-radius: 4px 4px 0 0;
}

.category-text-item:last-child {
    border-radius: 0 0 4px 4px;
    border-bottom: none;  /* Remove bottom border from last item */
}

/* If there's only one item, round all corners */
.category-text-item:only-child {
    border-radius: 4px;
}

.theme-dark .category-text-item {
    background: #2d2d2d;
    border-color: #444;
}

.category-text-item input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
    accent-color: #2c844d;
    flex-shrink: 0;

    margin: 0;
    padding: 0;
    vertical-align: middle;
    align-self: center;
    position: relative;
    top: 0;
}

.category-text-item span {
    flex: 1;
    font-size: 1em;
    color: #333;

    /* Critical text alignment fixes */
    line-height: 1.5;        /* Better for CJK characters */
    display: flex;           /* Makes text a flex container */
    align-items: center;     /* Centers text vertically within its own space */
    min-height: 1.5em;       /* Matches line-height for consistency */
    margin: 0;               /* Remove any inherited margins */
    padding-top: 1.5px;
}

.theme-dark .category-text-item span {
    color: #ddd;
}

/* Hover effect */
@media (hover: hover) and (pointer: fine) {
    .category-text-item:hover {
        background-color: #f0fdf4;
    }

    .theme-dark .category-text-item:hover {
        background-color: #1a3a2a;
        border-left-color: #5ddea3;
    }
}

/* Selected state */
.category-text-item:has(input:checked) {
    background-color: #e6f7ed;
}

.theme-dark .category-text-item:has(input:checked) {
    background-color: #1a3a2a;
    border-left-color: #5ddea3;
}

.category-text-item:has(input:checked) span {
    font-weight: 600;
    color: #2c844d;
}

.theme-dark .category-text-item:has(input:checked) span {
    color: #5ddea3;
}
/* ========================================
   INPUT LABELS FOR COMMENT COLUMN
   ======================================== */
.feedback-input-label-horizontal {
    font-size: 0.85em;
    color: #555;
    white-space: nowrap;
    flex-shrink: 0;

    /* Override global label margins */
    margin: 0 !important;
    margin-bottom: 0 !important;

    /* Perfect vertical alignment with input */
    display: inline-flex;
    align-items: center;
    line-height: 1;
    align-self: center;
}

/* Ensure parent container uses center alignment */
.feedback-input-group-horizontal {
    display: flex;
    align-items: center; /* This ensures vertical centering */
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 8px;
}

.theme-dark .feedback-input-label-horizontal {
    color: #bbb;
}

/* Adjust input to take remaining space */
.feedback-input-group-horizontal .feedback-contact-input-compact {
    flex: 1;
    min-width: 0;
    border-radius: 4px;
}

.feedback-input-group {
    display: none; /* Hide if there are any remaining vertical groups */
}

/* Ensure upload section has proper spacing */
.feedback-upload-compact {
    margin-top: 10px;
}

.feedback-input-label {
    font-size: 0.75em;
    font-weight: 600;
    color: #555;
    margin: 0;
    padding-left: 2px;
}

.theme-dark .feedback-input-label {
    color: #bbb;
}

/* Adjust existing input styles to work with labels */
.feedback-contact-input-compact,
.feedback-content-compact {
    width: 100%;
    box-sizing: border-box;
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.8em;
    transition: border-color 0.2s;
}
/* ========================================
   COLUMN 3: COMPACT COMMENT FORM
   ======================================== */
.feedback-comment-col {
    display: flex;
    flex-direction: column;
}

.feedback-contact-input-compact {
    width: 100%;
    box-sizing: border-box;
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.8em;
    transition: border-color 0.2s;
}

.feedback-contact-input-compact:focus {
    outline: none;
    border-color: #2c844d;
}

.theme-dark .feedback-contact-input-compact {
    background-color: #222;
    border-color: #555;
    color: #ddd;
}

.theme-dark .feedback-contact-input-compact:focus {
    border-color: #5ddea3;
}

.feedback-content-compact {
    width: 100%;
    box-sizing: border-box;
    min-height: 110px;
    padding: 6px 8px;
    border-radius: 4px;
    border: 1px solid #ccc;
    font-size: 0.8em;
    line-height: 1.4;
    resize: vertical;
    font-family: inherit;
}

.feedback-content-compact:focus {
    outline: none;
    border-color: #2c844d;
}

.theme-dark .feedback-content-compact {
    background-color: #222;
    border-color: #555;
    color: #ddd;
}

.theme-dark .feedback-content-compact:focus {
    border-color: #5ddea3;
}

/* Upload section */
.feedback-upload-compact {
    display: flex;
    align-items: center;
    gap: 6px;
}

.feedback-upload-btn-compact {
    background: transparent;
    border: 1px dashed #ccc;
    color: #555;
    padding: 4px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.75em;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.feedback-upload-btn-compact:hover {
    border-color: #2c844d;
    color: #2c844d;
    background-color: #f0fdf4;
}

.theme-dark .feedback-upload-btn-compact {
    border-color: #555;
    color: #aaa;
}

.theme-dark .feedback-upload-btn-compact:hover {
    border-color: #5ddea3;
    color: #5ddea3;
    background-color: #333;
}

.feedback-file-hint {
    font-size: 0.7em;
    color: #888;
}

.feedback-file-list-compact {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.feedback-file-item-compact {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border: 1px solid #e1e4e8;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 0.75em;
}

.theme-dark .feedback-file-item-compact {
    background: #2d2d2d;
    border-color: #444;
}

.feedback-file-name-compact {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    max-width: 80%;
    color: #333;
}

.theme-dark .feedback-file-name-compact {
    color: #ddd;
}

.feedback-file-remove-compact {
    cursor: pointer;
    color: #999;
    padding: 2px 4px;
    transition: color 0.2s;
}

.feedback-file-remove-compact:hover {
    color: #cb2431;
}

/* ========================================
   SUBMIT BUTTON AT BOTTOM
   ======================================== */
.feedback-submit-container {
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.feedback-submit-main {
    padding: 10px 40px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    border: none;
    background-color: #2c844d;
    color: white;
    font-size: 0.95em;
    transition: all 0.2s ease;
}

.feedback-submit-main:hover:not(:disabled) {
    background-color: #246d3f;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(44, 132, 77, 0.3);
}

.feedback-submit-main:disabled {
    background-color: #d1d5db; /* Grey background */
    color: #9ca3af; /* Grey text */
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: none;
}

.theme-dark .feedback-submit-main:disabled {
    background-color: #4b5563;
    color: #6b7280;
}

/* ========================================
   FINAL STATE
   ======================================== */
.feedback-final-state p {
    font-weight: bold;
    color: #2c844d;
    font-size: 1.1em;
}

.theme-dark .feedback-final-state p {
    color: #5ddea3;
}

.feedback-message {
    font-weight: bold;
}

.feedback-message.error {
    color: #cb2431;
}

.theme-dark .feedback-message.error {
    color: #ff8e8e;
}


/* ========================================
   MOBILE RESPONSIVE - ENHANCED LAYOUT
   ======================================== */

/* Tablet View (768px - 992px) */
@media screen and (max-width: 992px) {
    .feedback-three-column-layout {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto;
        gap: 15px;
        grid-template-areas:
            "emoji category"
            "comment comment";
    }

    .feedback-emoji-col {
        grid-area: emoji;
    }

    .feedback-category-col {
        grid-area: category;
    }

    .feedback-comment-col {
        grid-area: comment;
    }

    /* Slightly increase input font size for better mobile UX */
    .feedback-contact-input-compact,
    .feedback-content-compact {
        font-size: 0.9em;
    }
}

/* Mobile View (≤768px) */
@media screen and (max-width: 768px) {
    .page-feedback {
        padding: 15px 10px;
    }

    .feedback-three-column-layout {
        gap: 12px;
    }

    .feedback-col-title {
        font-size: 0.9em;
        margin-bottom: 0px;
    }

    /* ========================================
       MOBILE EMOJI - PRESERVE ALIGNMENT
       ======================================== */
    .feedback-emoji-mini {
        padding: 3px 8px;  /* ⚠️ Reduced padding but keep horizontal consistency */
    }

    .emoji-icon-mini {
        font-size: 1.6em;
        min-width: 32px;
    }

    .emoji-label-mini {
        font-size: 0.85em;
        line-height: 1.5;
    }

    .category-text-item {
        padding: 3px 8px;  /* Match emoji padding for consistency */
        display: flex !important;
        align-items: center !important;
    }

    .category-text-item input[type="checkbox"] {
        width: 16px;
        height: 16px;
        margin: 0;
        padding: 0;
        vertical-align: middle;
        align-self: center;
        position: relative;
        top: 0;
    }

    .category-text-item span {
        font-size: 0.95em;
        line-height: 1.5;
        display: flex;
        align-items: center;
        min-height: 1.5em;
        margin: 0;
        padding-top: 2.5px;
    }

    /* Comment section optimizations */
    .feedback-content-compact {
        min-height: 60px;
        font-size: 0.9em;
    }

    .feedback-input-label {
        font-size: 0.8em;
    }
}
