/**
 * PostPusher CSS Styles - Modern Slide-out Drawer Design
 */

/* Thread Button */
.postpusher_thread_button {
    display: inline-flex;
    margin-left: 10px;
    vertical-align: middle;
}

.postpusher_button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 7px 16px;
    background: #0078db;
    color: #fff !important;
    text-decoration: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 120, 219, 0.25);
    letter-spacing: 0.3px;
    line-height: 1.4;
}

a.button.postpusher_button,
a.postpusher_button {
    text-decoration: none !important;
}

a.button.postpusher_button span,
span.postpusher_button {
    background-image: none !important;
    font-weight: 600;
    padding: 0;
    margin: 0;
}

.postpusher_button:hover {
    background: #fa7305 !important;
    box-shadow: 0 2px 6px rgba(250, 115, 5, 0.35);
    transform: translateY(-1px);
}

.postpusher_button:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 120, 219, 0.3);
}

.postpusher_btn_icon {
    flex-shrink: 0;
    margin-top: -1px;
}

/* Drawer Overlay - Dimmed background */
#postpusher_overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#postpusher_overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Slide-up Drawer from Bottom */
#postpusher_drawer {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    width: 1000px;
    max-width: 95vw;
    max-height: 90vh;
    height: auto;
    background: #fff;
    border-radius: 20px 20px 0 0;
    z-index: 9999;
    box-shadow: 0 -10px 60px rgba(0, 0, 0, 0.25);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.4s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    visibility: hidden;
    opacity: 0;
}

#postpusher_drawer.active {
    transform: translateX(-50%) translateY(0);
    visibility: visible;
    opacity: 1;
}

/* Drawer Header */
#postpusher_drawer .drawer_header {
    padding: 20px 28px;
    background: #0078db;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    position: relative;
}

#postpusher_drawer .drawer_header::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 2px;
}

#postpusher_drawer .drawer_header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: 0.3px;
}

#postpusher_drawer .drawer_header h3::before {
    content: "⚡";
    margin-right: 8px;
    font-size: 18px;
}

#postpusher_drawer .drawer_close {
    color: #fff;
    font-size: 28px;
    text-decoration: none;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.1);
}

#postpusher_drawer .drawer_close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}

/* Drawer Body */
#postpusher_drawer .drawer_body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
    background: #f8f9fa;
}

/* Drawer Footer */
#postpusher_drawer .drawer_footer {
    padding: 20px 28px;
    border-top: 1px solid #e9ecef;
    background: #fff;
    flex-shrink: 0;
}

/* Section Styling */
.postpusher_section {
    padding: 20px 28px;
    border-bottom: 1px solid #e9ecef;
    background: #fff;
}

.postpusher_section:last-child {
    border-bottom: none;
}

/* Search Bar for Position Selector */
.postpusher_search_container {
    margin-bottom: 15px;
}

.postpusher_search_wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.postpusher_search_icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    pointer-events: none;
    z-index: 1;
    font-size: 16px;
}

.postpusher_search_input {
    width: 100%;
    padding: 14px 40px 14px 44px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    color: #374151;
    background: #f9fafb;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.postpusher_search_input::placeholder {
    color: #9ca3af;
}

.postpusher_search_input:focus {
    outline: none;
    border-color: #667eea;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.postpusher_search_clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: #e5e7eb;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 16px;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: all 0.15s ease;
}

.postpusher_search_clear:hover {
    background: #d1d5db;
    color: #374151;
}

.postpusher_search_results {
    font-size: 12px;
    color: #6b7280;
    margin-top: 8px;
    text-align: left;
    font-weight: 500;
}

.postpusher_search_highlight {
    background: #0078db;
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

/* No results message */
.postpusher_no_results {
    text-align: center;
    padding: 30px;
    color: #888;
}

.postpusher_no_results_icon {
    font-size: 32px;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* Search Bar for Position Selector */
.postpusher_search_container {
    margin-bottom: 15px;
    position: relative;
}

.postpusher_search_input {
    width: 100%;
    padding: 12px 15px 12px 40px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.postpusher_search_input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.postpusher_search_icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 16px;
    pointer-events: none;
}

.postpusher_search_results {
    font-size: 12px;
    color: #888;
    margin-top: 8px;
    text-align: right;
}

.postpusher_search_highlight {
    background: #0078db;
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

/* No results message */
.postpusher_no_results {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
    background: #f9fafb;
    border-radius: 8px;
    margin: 10px 0;
}

.postpusher_no_results_icon {
    color: #9ca3af;
    margin-bottom: 12px;
    display: flex;
    justify-content: center;
}

.postpusher_no_results_hint {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 8px;
}

.postpusher_section_title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.postpusher_section_title::before {
    content: "";
    width: 4px;
    height: 16px;
    background: #0078db;
    border-radius: 2px;
}

/* Position Selector - Visual Timeline */
.postpusher_position_list {
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    display: flex;
    flex-direction: column;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.03);
}

.postpusher_position_item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

.postpusher_position_item:last-child {
    border-bottom: none;
}

.postpusher_position_item:hover {
    background: #f8f9fa;
}

.postpusher_position_item.selected {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
    border-left: 4px solid #667eea;
}

.postpusher_position_item input[type="radio"] {
    display: none;
}

.postpusher_position_radio {
    width: 22px;
    height: 22px;
    border: 2px solid #d1d5db;
    border-radius: 50%;
    margin-right: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.postpusher_position_item.selected .postpusher_position_radio {
    border-color: #667eea;
    background: #667eea;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.postpusher_position_radio::after {
    content: "";
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
    transform: scale(0);
    transition: transform 0.2s ease;
}

.postpusher_position_item.selected .postpusher_position_radio::after {
    transform: scale(1);
}

.postpusher_position_info {
    flex: 1;
    min-width: 0;
}

.postpusher_position_subject {
    font-weight: 600;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px;
    margin-bottom: 3px;
}

.postpusher_position_message {
    font-size: 11px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: #f3f4f6;
    padding: 4px 8px;
    border-radius: 4px;
    margin-bottom: 4px;
    font-style: italic;
}

.postpusher_position_meta {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 2px;
}

.postpusher_position_number {
    font-size: 12px;
    font-weight: 600;
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    padding: 3px 8px;
    border-radius: 12px;
    margin-left: 8px;
}

/* Form Inputs */
.postpusher_input_group {
    margin-bottom: 18px;
}

.postpusher_input_group:last-child {
    margin-bottom: 0;
}

.postpusher_input_group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.postpusher_input_group input[type="text"],
.postpusher_input_group textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.2s ease;
    box-sizing: border-box;
    background: #f9fafb;
}

.postpusher_input_group input[type="text"]:focus,
.postpusher_input_group textarea:focus {
    outline: none;
    border-color: #667eea;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.postpusher_input_group textarea:not(.sceditor-container):not(.sceditor-editor) {
    resize: vertical;
    min-height: 220px;
}

/* SCEditor toolbar left alignment */
#postpusher_new_message + .sceditor-container .sceditor-toolbar {
    text-align: left;
}

#postpusher_new_message + .sceditor-container .sceditor-toolbar .sceditor-group {
    float: left;
}

/* Toggle Switch for Advance Mode */
.postpusher_toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    cursor: pointer;
    padding: 10px 0;
}

.postpusher_toggle_input {
    display: none;
}

.postpusher_toggle_switch {
    width: 52px;
    height: 28px;
    background: #e5e7eb;
    border-radius: 14px;
    position: relative;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.postpusher_toggle_switch::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    background: #fff;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.postpusher_toggle_input:checked + .postpusher_toggle_switch {
    background: #0078db;
}

.postpusher_toggle_input:checked + .postpusher_toggle_switch::after {
    left: 27px;
}

.postpusher_toggle_label {
    font-size: 14px;
    color: #4b5563;
}

.postpusher_toggle_label strong {
    color: #1f2937;
}

.postpusher_toggle_desc {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 2px;
}

/* Drawer Footer */
#postpusher_drawer .drawer_footer {
    padding: 20px 24px;
    border-top: 2px solid #f0f0f0;
    background: #fafafa;
    flex-shrink: 0;
}

#postpusher_submit {
    width: 100%;
    padding: 16px 28px;
    background: #0078db;
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(0, 120, 219, 0.35);
    letter-spacing: 0.3px;
}

#postpusher_submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 120, 219, 0.45);
}

#postpusher_submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#postpusher_submit::before {
    content: "➤";
    font-size: 14px;
}

/* Loading State */
.postpusher_loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #888;
}

.postpusher_loading_spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f0f0f0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: postpusher_spin 1s linear infinite;
    margin-bottom: 15px;
}

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

/* Error Message */
.postpusher_error {
    color: #c00;
    padding: 15px;
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 8px;
    margin: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.postpusher_error::before {
    content: "⚠";
    font-size: 18px;
}

/* Empty State */
.postpusher_empty {
    text-align: center;
    padding: 40px;
    color: #888;
}

.postpusher_empty::before {
    content: "📝";
    font-size: 48px;
    display: block;
    margin-bottom: 15px;
    opacity: 0.3;
}

/* Scrollbar Styling */
#postpusher_drawer .drawer_body::-webkit-scrollbar,
.postpusher_position_list::-webkit-scrollbar {
    width: 8px;
}

#postpusher_drawer .drawer_body::-webkit-scrollbar-track,
.postpusher_position_list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#postpusher_drawer .drawer_body::-webkit-scrollbar-thumb,
.postpusher_position_list::-webkit-scrollbar-thumb {
    background: #0078db;
    border-radius: 4px;
}

#postpusher_drawer .drawer_body::-webkit-scrollbar-thumb:hover,
.postpusher_position_list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
}

/* Notification Styles */
.postpusher_notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    color: #fff;
    font-weight: 500;
    z-index: 10000;
    transform: translateX(150%);
    transition: transform 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    max-width: 400px;
}

.postpusher_notification.show {
    transform: translateX(0);
}

.postpusher_notification_success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.postpusher_notification_error {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
}

/* Animation for drawer header icons */
@keyframes postpusher_pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Smooth focus transitions */
.postpusher_position_item {
    position: relative;
}

.postpusher_position_item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #0078db;
    transform: scaleY(0);
    transition: transform 0.2s ease;
}

.postpusher_position_item.selected::before {
    transform: scaleY(1);
}

/* Subject Field Hint */
.postpusher_hint {
    display: block;
    font-size: 11px;
    color: #888;
    margin-top: 5px;
    font-style: italic;
}

/* Search Container */
.postpusher_search_container {
    position: relative;
    margin-bottom: 15px;
}

.postpusher_search_icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: #888;
    pointer-events: none;
}

.postpusher_search_input {
    width: 100%;
    padding: 10px 12px 10px 35px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.postpusher_search_input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.postpusher_search_results {
    font-size: 12px;
    color: #888;
    margin-top: 5px;
}

/* No Results */
.postpusher_no_results {
    text-align: center;
    padding: 30px;
    color: #888;
}

.postpusher_no_results_icon {
    font-size: 36px;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* Responsive */
@media (min-width: 1400px) {
    #postpusher_drawer {
        width: 1200px;
        max-width: 1200px;
        box-shadow: 0 -15px 80px rgba(0, 0, 0, 0.3);
    }
}

@media (max-width: 768px) {
    #postpusher_drawer {
        width: 100%;
        max-width: 100%;
        border-radius: 16px 16px 0 0;
        max-height: 95vh;
    }

    .postpusher_section {
        padding: 16px 20px;
    }

    #postpusher_drawer .drawer_header,
    #postpusher_drawer .drawer_footer {
        padding: 16px 20px;
    }

    #postpusher_drawer .drawer_header h3 {
        font-size: 18px;
    }
}

/* Filtered state for position items */
.postpusher_position_item.filtered-hidden {
    display: none !important;
}

/* Search result highlighting - animated border on match */
.postpusher_position_item[data-pid-match="true"] {
    animation: postpusher_highlight 0.5s ease;
}

@keyframes postpusher_highlight {
    0% {
        background: rgba(102, 126, 234, 0.3);
    }
    100% {
        background: transparent;
    }
}

/* Debug Panel - activated via ?pushdebug=1 */
#pp_debug_panel {
    margin-top: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 11px;
    font-family: monospace;
    background: #1a202c;
    color: #e2e8f0;
    overflow: hidden;
}
.pp_dbg_hdr {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #2d3748;
    border-bottom: 1px solid #4a5568;
}
.pp_dbg_title {
    font-weight: 600;
    font-size: 11px;
    color: #a0aec0;
    flex: 1;
}
.pp_dbg_btn {
    border: none;
    border-radius: 3px;
    padding: 2px 8px;
    font-size: 10px;
    font-family: inherit;
    cursor: pointer;
    font-weight: 600;
}
.pp_dbg_copy {
    background: #4299e1;
    color: #fff;
}
.pp_dbg_copy:hover { background: #3182ce; }
.pp_dbg_dl {
    background: #48bb78;
    color: #fff;
}
.pp_dbg_dl:hover { background: #38a169; }
.pp_dbg_clr {
    background: #e53e3e;
    color: #fff;
}
.pp_dbg_clr:hover { background: #c53030; }
.pp_dbg_body {
    max-height: 250px;
    overflow-y: auto;
    padding: 6px 10px;
}
.pp_dbg_row {
    padding: 3px 0;
    border-bottom: 1px solid #2d3748;
    display: flex;
    gap: 8px;
    line-height: 1.4;
}
.pp_dbg_row:last-child { border-bottom: none; }
.pp_dbg_t {
    color: #718096;
    white-space: nowrap;
    min-width: 60px;
}
.pp_dbg_l {
    font-weight: 700;
    white-space: nowrap;
    min-width: 48px;
}
.pp_dbg_k {
    color: #a0aec0;
    white-space: nowrap;
    min-width: 120px;
}
.pp_dbg_v {
    color: #cbd5e0;
    word-break: break-all;
}
.pp_dbg_get { color: #63b3ed; }
.pp_dbg_post { color: #63b3ed; }
.pp_dbg_user { color: #9ae6b4; }
.pp_dbg_php { color: #a0aec0; }
.pp_dbg_ok { color: #68d391; }
.pp_dbg_fail { color: #fc8181; }
.pp_dbg_cfg { color: #b794f4; }
.pp_dbg_db { color: #90cdf4; }
.pp_dbg_thread { color: #fbd38d; }
.pp_dbg_result { color: #f6ad55; }
.pp_dbg_after { color: #fed7aa; }
.pp_dbg_action { color: #fbd38d; }
.pp_dbg_target { color: #fca5a5; }
.pp_dbg_auth { color: #f6e05e; }

/* Debug Float Button */
#pp_dbg_float {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 99999;
    background: #e53e3e;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    font-family: monospace;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(229,62,62,0.4);
    transition: background 0.15s;
    user-select: none;
    letter-spacing: 1px;
}
#pp_dbg_float:hover {
    background: #c53030;
}

/* Debug Modal */
#pp_dbg_modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 99998;
    background: rgba(0,0,0,0.6);
}
#pp_dbg_modal_content {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 800px;
    max-height: calc(100vh - 100px);
    background: #1a202c;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
#pp_dbg_modal_header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #2d3748;
    color: #e2e8f0;
    font-size: 14px;
    font-weight: 700;
    font-family: monospace;
    border-bottom: 1px solid #4a5568;
}
#pp_dbg_modal_close {
    font-size: 22px;
    cursor: pointer;
    color: #a0aec0;
    line-height: 1;
}
#pp_dbg_modal_close:hover {
    color: #fc8181;
}
#pp_dbg_modal_body {
    padding: 0;
    overflow-y: auto;
    max-height: calc(100vh - 160px);
}
#pp_dbg_modal_body #pp_debug_panel {
    margin: 0;
    border: none;
    border-radius: 0;
}
