/* Create Post Box Styles - Facebook Style */
.create-post-box {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid #e0e0e0;
}

.post-box-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(45deg, #007bff, #0056b3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    margin-right: 12px;
    font-size: 16px;
}

.post-box-trigger {
    flex: 1;
    background: #f0f2f5;
    border: none;
    border-radius: 25px;
    padding: 12px 20px;
    text-align: left;
    color: #65676b;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-size: 14px;
}

.post-box-trigger:hover {
    background: #e4e6e9;
}

/* Horizontal Scrollable Post Options */
.post-options-scroll-container {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 5px;
    border-top: 1px solid #e0e0e0;
    padding-top: 15px;
}

.post-options-wrapper {
    display: flex;
    gap: 8px;
    min-width: max-content;
    padding-right: 15px;
}

.post-option {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #65676b;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    background: white;
    border: 1px solid #f0f2f5;
    min-width: max-content;
    flex-shrink: 0;
}

.post-option:hover {
    background: #f0f2f5;
    color: #007bff;
    text-decoration: none;
    border-color: #e0e0e0;
    transform: translateY(-1px);
}

.post-option i {
    margin-right: 8px;
    font-size: 16px;
    width: 16px;
    text-align: center;
}

/* Compact Horizontal Template Selection */
.template-scroll-container {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 10px;
}

.template-scroll-wrapper {
    display: flex;
    gap: 8px;
    min-width: max-content;
    padding-right: 15px;
}

.template-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 2px solid #e9ecef;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    min-width: max-content;
    flex-shrink: 0;
}

.template-chip:hover {
    border-color: #007bff;
    background-color: #f8f9fa;
}

.template-chip.active {
    border-color: #007bff;
    background-color: #e7f3ff;
    color: #007bff;
}

.template-chip-icon {
    font-size: 14px;
    width: 16px;
    text-align: center;
}

.template-chip-name {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

/* FIXED: Scrollable Form Container */
.form-scroll-container {
    overflow-y: auto;
    flex: 1;
    min-height: 0; /* IMPORTANT: Flexbox ke liye required */
    position: relative; /* Contain scrolling context */
}

/* Form content inside scroll container */
#formContainer {
    min-height: min-content; /* Ensure content can grow */
}

/* Toast Styles */
.custom-toast {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-left: 4px solid #007bff;
    min-width: 300px;
}

.custom-toast.success {
    border-left-color: #28a745;
}

.custom-toast.error {
    border-left-color: #dc3545;
}

.custom-toast.warning {
    border-left-color: #ffc107;
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: #007bff;
    width: 100%;
    animation: progress 5s linear;
}

.custom-toast.success .toast-progress {
    background: #28a745;
}

.custom-toast.error .toast-progress {
    background: #dc3545;
}

@keyframes progress {
    from { width: 100%; }
    to { width: 0%; }
}

/* Scrollbar Styling for Horizontal Containers */
.post-options-scroll-container::-webkit-scrollbar,
.template-scroll-container::-webkit-scrollbar {
    height: 4px;
}

.post-options-scroll-container::-webkit-scrollbar-track,
.template-scroll-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.post-options-scroll-container::-webkit-scrollbar-thumb,
.template-scroll-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

.post-options-scroll-container::-webkit-scrollbar-thumb:hover,
.template-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Form scrollbar styling */
.form-scroll-container::-webkit-scrollbar {
    width: 6px;
}

.form-scroll-container::-webkit-scrollbar-track {
    background: #f8f9fa;
    border-radius: 3px;
}

.form-scroll-container::-webkit-scrollbar-thumb {
    background: #dee2e6;
    border-radius: 3px;
}

.form-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #adb5bd;
}

/* Mobile Fullscreen Styles */
@media (max-width: 768px) {
    #createPostModal .modal-dialog {
        margin: 0;
        max-width: 100vw;
        height: 100vh;
    }
    
    #createPostModal .modal-content {
        height: 100vh;
        border-radius: 0;
        border: none;
        display: flex;
        flex-direction: column;
    }
    
    #createPostModal .modal-body {
        flex: 1;
        display: flex;
        flex-direction: column;
        min-height: 0; /* IMPORTANT: Flexbox fix */
    }
    
    /* FIXED: Form scroll container height calculation */
    .form-scroll-container {
        height: auto;
        flex: 1;
        min-height: 0;
        max-height: none;
    }
    
    .template-scroll-container {
        margin: 0 -15px;
        padding: 0 15px 10px;
    }
    
    .post-options-scroll-container {
        margin: 0 -15px;
        padding: 15px 15px 5px;
    }
    
    /* Ensure proper spacing on mobile */
    #createPostModal .modal-header {
        padding: 1rem;
        border-bottom: 1px solid #dee2e6;
        flex-shrink: 0; /* Prevent header from shrinking */
    }
    
    #createPostModal .modal-body .p-3 {
        padding: 1rem !important;
    }
    
    /* Post options mobile optimization */
    .post-option {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .post-option i {
        font-size: 14px;
        margin-right: 6px;
    }
    
    /* Safe area support for notch devices */
    @supports (padding: max(0px)) {
        #createPostModal .modal-content {
            padding-left: max(0px, env(safe-area-inset-left));
            padding-right: max(0px, env(safe-area-inset-right));
            padding-top: max(0px, env(safe-area-inset-top));
            padding-bottom: max(0px, env(safe-area-inset-bottom));
        }
    }
}

/* Desktop Styles */
@media (min-width: 769px) {
    #createPostModal .modal-dialog {
        max-width: 600px;
        width: 90%;
        margin: 1.75rem auto;
    }
    
    #createPostModal .modal-content {
        max-height: 80vh; /* Reduced from 90vh for better spacing */
        height: auto;
        border-radius: 12px;
        display: flex;
        flex-direction: column;
    }
    
    #createPostModal .modal-body {
        flex: 1;
        display: flex;
        flex-direction: column;
        min-height: 0;
    }
    
    /* FIXED: Desktop form container */
    .form-scroll-container {
        max-height: 45vh; /* Reduced for better fit */
        min-height: 200px;
        flex: 1;
    }
    
    /* Desktop pe thoda better spacing */
    .post-option {
        padding: 10px 16px;
    }
}

/* Modal body flex fixes */
#createPostModal .modal-body {
    min-height: 0; /* Crucial for flexbox scrolling */
}

/* Prevent body scroll when modal is open on mobile */
body.modal-open-mobile {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* Firefox scrollbar styling */
.post-options-scroll-container,
.template-scroll-container {
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 #f1f1f1;
}

.form-scroll-container {
    scrollbar-width: thin;
    scrollbar-color: #dee2e6 #f8f9fa;
}

/* Additional safety for form content */
#formContainer {
    box-sizing: border-box;
}

/* Ensure modal content doesn't overflow */
#createPostModal .modal-content {
    overflow: hidden; /* Prevent overall modal overflow */
}


/* tags related code in fors*/
/* Tags Input Plus Button Styling */
.tag-plus-btn {
    background: #e9ecef;
    border: 1px solid #dee2e6;
    color: #6c757d;
    border-radius: 4px;
    width: 36px;
    height: 36px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin-left: 8px;
    flex-shrink: 0;
}

.tag-plus-btn:hover:not(:disabled) {
    background: #dee2e6;
    transform: scale(1.05);
}

.tag-plus-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tag-plus-btn.active {
    background: #0d6efd;
    color: white;
    border-color: #0d6efd;
}

.tag-plus-btn.active:hover {
    background: #0b5ed7;
    border-color: #0a58ca;
}

/* Tags input container layout */
.tags-input-container {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: white;
}

.tags-input {
    flex: 1;
    min-width: 150px;
    border: none;
    outline: none;
    padding: 8px;
    font-size: 14px;
}

/* Tag items styling */
.tag-item {
    background: #0d6efd;
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}

.remove-tag {
    background: transparent;
    border: none;
    color: white;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.remove-tag:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Suggestions */
.tags-suggestions {
    position: absolute;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    max-height: 200px;
    overflow-y: auto;
    width: 100%;
    z-index: 1000;
    display: none;
    margin-top: 2px;
}

.tags-suggestion-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
}

.tags-suggestion-item:hover {
    background: #f8f9fa;
}

/* Validation messages */
.tag-validation {
    font-size: 12px;
    margin-top: 4px;
    display: none;
}

.tag-validation.valid {
    color: #198754;
}

.tag-validation.invalid {
    color: #dc3545;
}
/* =========================================================
   MODAL HEADER (USER INFO + BADGE)
========================================================= */
.custom-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #fff;
}

.header-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-user-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.header-username {
    font-size: 15px;
    font-weight: 600;
    color: #212529;
    text-transform: lowercase;
}

/* 🔥 FIRST LETTER BIG */
.header-username::first-letter {
    font-size: 22px;
    font-weight: 700;
    color: #0d6efd;
    text-transform: uppercase;
}

.header-post-badge {
    margin-top: 3px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 14px;
    background: linear-gradient(135deg, #0d6efd, #6610f2);
    color: #fff;
    width: fit-content;
    box-shadow: 0 2px 6px rgba(13,110,253,0.25);
}

/* Login Required Container Styling */
.login-required-container {
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.login-required-container .login-icon {
    color: #ffc107;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* For non-logged-in post trigger */
.post-box-trigger:not(.logged-in) {
    background-color: #f8f9fa;
    color: #6c757d;
    border: 1px dashed #dee2e6;
}

.post-box-trigger:not(.logged-in):hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
}

/* Guest user avatar styling */
.user-avatar .fas.fa-user {
    font-size: 14px;
    color: #6c757d;
}
