/**
 * Styles dla Tablicy
 * Customer Management Plugin
 */

/* ============================================
   GŁÓWNA STRUKTURA TABLICY
   ============================================ */

.tablica {
    display: flex;
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.posty-natablicy {
    flex: 0 0 70%;
    max-width: 70%;
}

.tablica-informacje {
    flex: 0 0 30%;
    max-width: 30%;
}

/* ============================================
   NAPISZ POST
   ============================================ */

.napisz-post {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    display: flex;
    gap: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.napisz-post:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-color: #2271b1;
}

.avatar-wpis {
    flex-shrink: 0;
}

.avatar-wpis img {
    border-radius: 50%;
    width: 48px;
    height: 48px;
}

.napisz-wiadomosc {
    flex: 1;
    background: #f5f5f5;
    border-radius: 24px;
    padding: 12px 20px;
    color: #666;
    font-size: 15px;
    display: flex;
    align-items: center;
    transition: background 0.3s;
}

.napisz-post:hover .napisz-wiadomosc {
    background: #e8e8e8;
}

/* ============================================
   WSZYSTKIE POSTY
   ============================================ */

.wszystkie-posty {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* ============================================
   POJEDYNCZY POST
   ============================================ */

.tablica-post {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s;
}

.tablica-post:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* Post admina - wyróżniony */
.tablica-post.admin-post {
    background: linear-gradient(135deg, #fff9e6 0%, #fff 100%);
    border: 2px solid #ffc107;
    box-shadow: 0 2px 12px rgba(255, 193, 7, 0.15);
}

.tablica-post.admin-post:hover {
    box-shadow: 0 4px 16px rgba(255, 193, 7, 0.25);
}

/* Header posta */
.post-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.post-author-info {
    display: flex;
    gap: 12px;
    flex: 1;
}

.post-avatar img {
    border-radius: 50%;
    width: 48px;
    height: 48px;
}

.post-author-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.post-author-name {
    font-weight: 600;
    font-size: 15px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-badge {
    display: inline-block;
    padding: 2px 8px;
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.post-date {
    font-size: 13px;
    color: #666;
}

.post-actions {
    display: flex;
    gap: 8px;
}

.post-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 18px;
}

.post-action-btn:hover {
    background: #f5f5f5;
}

.post-delete:hover {
    background: #fee;
}

/* Treść posta */
.post-content {
    margin-bottom: 15px;
    font-size: 15px;
    line-height: 1.6;
    color: #333;
    word-wrap: break-word;
}

.post-content p {
    margin: 0 0 10px;
}

.post-content p:last-child {
    margin-bottom: 0;
}

/* Footer posta */
.post-footer {
    display: flex;
    gap: 15px;
    padding-top: 12px;
    border-top: 1px solid #eee;
}

.post-reaction,
.post-comment-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #666;
    transition: all 0.2s;
}

.post-reaction:hover,
.post-comment-btn:hover {
    background: #f5f5f5;
}

.reaction-icon,
.comment-icon {
    font-size: 18px;
}

.reaction-count {
    font-weight: 500;
}

/* ============================================
   POPUP DO DODAWANIA POSTA
   ============================================ */

.tablica-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tablica-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.tablica-popup-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    animation: popupSlideIn 0.3s ease-out;
}

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

.tablica-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
}

.tablica-popup-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.tablica-popup-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 28px;
    color: #666;
}

.tablica-popup-close:hover {
    background: #f5f5f5;
    color: #333;
}

.tablica-popup-body {
    padding: 24px;
    max-height: calc(90vh - 140px);
    overflow-y: auto;
}

.popup-user-info {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    align-items: center;
}

.popup-avatar img {
    border-radius: 50%;
    width: 48px;
    height: 48px;
}

.popup-user-name {
    font-size: 15px;
}

.tablica-post-form .form-group {
    margin-bottom: 0;
}

.tablica-textarea {
    width: 100%;
    border: none;
    resize: vertical;
    font-size: 15px;
    line-height: 1.6;
    color: #333;
    font-family: inherit;
    padding: 8px 0;
    min-height: 120px;
}

.tablica-textarea:focus {
    outline: none;
}

.tablica-textarea::placeholder {
    color: #999;
}

.tablica-popup-footer {
    padding-top: 16px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
}

.tablica-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.tablica-btn-primary {
    background: #2271b1;
    color: #fff;
}

.tablica-btn-primary:hover {
    background: #135e96;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 113, 177, 0.3);
}

.tablica-btn-primary:active {
    transform: translateY(0);
}

/* ============================================
   TABLICA INFORMACJE (prawa strona)
   ============================================ */

.tablica-informacje .info-box {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 20px;
    position: sticky;
    top: 80px;
}

.tablica-informacje .info-box h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 18px;
    color: #333;
}

/* ============================================
   EMPTY STATE
   ============================================ */

.cmp-empty-state {
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 12px;
}

.cmp-empty-state p {
    color: #666;
    font-size: 15px;
    margin: 8px 0;
}

/* ============================================
   RESPONSYWNOŚĆ
   ============================================ */

@media (max-width: 1024px) {
    .tablica {
        flex-direction: column;
    }
    
    .posty-natablicy,
    .tablica-informacje {
        flex: 1;
        max-width: 100%;
    }
    
    .tablica-informacje {
        order: -1;
    }
}

@media (max-width: 768px) {
    .tablica {
        padding: 10px;
    }
    
    .napisz-post {
        padding: 12px;
    }
    
    .tablica-post {
        padding: 16px;
    }
    
    .post-author-name {
        font-size: 14px;
    }
    
    .admin-badge {
        font-size: 10px;
        padding: 2px 6px;
    }
    
    .post-content {
        font-size: 14px;
    }
    
    .tablica-popup-content {
        width: 95%;
        margin: 10px;
    }
    
    .tablica-popup-body {
        padding: 16px;
    }
}


/* ============================================
   NOWY POPUP - SKOOL STYLE
   ============================================ */

/* Header popupu z avatarem */
.tablica-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e5e5;
}

.popup-user-info {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 0;
}

.popup-avatar {
    flex-shrink: 0;
}

.popup-avatar img {
    border-radius: 50%;
    width: 40px;
    height: 40px;
}

.popup-user-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.popup-user-details strong {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
}

.popup-action-text {
    font-size: 13px;
    color: #666;
}

/* Pole tytuł */
.tablica-input-title {
    width: 100%;
    border: none;
    outline: none;
    font-size: 24px;
    font-weight: 600;
    color: #1a1a1a;
    padding: 12px 0;
    background: transparent;
}

.tablica-input-title::placeholder {
    color: #ccc;
    font-weight: 500;
}

/* Pole tekstowe */
.tablica-textarea {
    width: 100%;
    border: none;
    outline: none;
    font-size: 15px;
    line-height: 1.6;
    color: #333;
    padding: 8px 0;
    resize: none;
    min-height: 120px;
    background: transparent;
}

.tablica-textarea::placeholder {
    color: #999;
}

/* Toolbar z ikonami */
.tablica-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-top: 1px solid #e5e5e5;
    margin-top: 12px;
}

.toolbar-left {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-wrap: wrap;
}

.toolbar-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: all 0.2s;
    width: 36px;
    height: 36px;
}

.toolbar-btn svg {
    stroke: #666;
    fill: none;
}

.toolbar-btn:hover:not(:disabled) {
    background: #f5f5f5;
    color: #333;
}

.toolbar-btn:hover:not(:disabled) svg {
    stroke: #333;
}

.toolbar-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.toolbar-btn svg {
    width: 20px;
    height: 20px;
}

.toolbar-btn-gif {
    width: auto;
    padding: 8px 12px;
}

.gif-text {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.toolbar-category {
    margin-left: 8px;
}

.toolbar-btn-category {
    background: none;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    position: relative;
}

.toolbar-btn-category:hover:not(:disabled) {
    background: #f5f5f5;
    border-color: #ccc;
}

.toolbar-btn-category:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.category-badge {
    background: #ffa500;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

/* Footer popupu z przyciskami */
.tablica-popup-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid #e5e5e5;
    margin-top: 16px;
}

.tablica-btn {
    padding: 10px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tablica-btn-cancel {
    background: #f5f5f5;
    color: #666;
}

.tablica-btn-cancel:hover {
    background: #e8e8e8;
    color: #333;
}

.tablica-btn-post {
    background: #2271b1;
    color: white;
}

.tablica-btn-post:hover:not(:disabled) {
    background: #135e96;
}

.tablica-btn-post:disabled {
    background: #e5e5e5;
    color: #999;
    cursor: not-allowed;
}

/* ============================================
   GIF PICKER MODAL
   ============================================ */

.gif-picker-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gif-picker-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
}

.gif-picker-content {
    position: relative;
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.gif-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e5e5;
}

.gif-picker-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.gif-picker-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #666;
    transition: all 0.2s;
}

.gif-picker-close:hover {
    background: #f5f5f5;
}

.gif-picker-search {
    padding: 16px 20px;
    border-bottom: 1px solid #e5e5e5;
}

.gif-picker-search input {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
}

.gif-picker-search input:focus {
    border-color: #2271b1;
}

.gif-picker-results {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    align-content: start;
}

.gif-item {
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s;
    aspect-ratio: 1;
}

.gif-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.gif-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gif-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

/* ============================================
   EMOJI PICKER
   ============================================ */

#emoji-picker-container {
    position: absolute;
    z-index: 10001;
}

/* Responsywność */
@media (max-width: 768px) {
    .tablica-popup-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .toolbar-left {
        gap: 2px;
    }
    
    .toolbar-btn {
        width: 32px;
        height: 32px;
        padding: 6px;
    }
    
    .gif-picker-results {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 8px;
    }
}

/* Tytuł posta */
.post-title {
    margin-bottom: 12px;
}

.post-title h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.3;
}

/* ============================================
   LINK POPUP
   ============================================ */

.link-popup-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.link-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
}

.link-popup-content {
    position: relative;
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.link-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e5e5;
}

.link-popup-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.link-popup-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #666;
    transition: all 0.2s;
}

.link-popup-close:hover {
    background: #f5f5f5;
}

.link-popup-body {
    padding: 24px;
}

.link-url-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.link-url-input:focus {
    border-color: #2271b1;
}

.link-popup-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid #e5e5e5;
}

.tablica-btn-primary {
    background: #ffc107;
    color: #1a1a1a;
}

.tablica-btn-primary:hover {
    background: #ffb300;
}

/* ============================================
   VIDEO POPUP
   ============================================ */

.video-popup-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
}

.video-popup-content {
    position: relative;
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.video-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e5e5;
}

.video-popup-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.video-popup-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #666;
    transition: all 0.2s;
}

.video-popup-close:hover {
    background: #f5f5f5;
}

.video-popup-body {
    padding: 24px;
}

.video-url-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.video-url-icon {
    color: #666;
}

.video-url-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.video-url-input:focus {
    border-color: #2271b1;
}

.video-upload-section {
    margin-top: 20px;
}

.video-upload-area {
    border: 2px dashed #ddd;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.video-upload-area:hover {
    border-color: #2271b1;
    background: #f8f9fa;
}

.upload-icon {
    color: #999;
    margin-bottom: 16px;
}

.upload-icon svg {
    display: inline-block;
}

.upload-text {
    font-size: 15px;
    color: #333;
    margin: 0 0 8px 0;
    font-weight: 500;
}

.upload-subtext {
    font-size: 14px;
    color: #666;
    margin: 0;
}

.upload-link {
    color: #2271b1;
    text-decoration: underline;
    cursor: pointer;
}

.upload-link:hover {
    color: #135e96;
}

.video-popup-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid #e5e5e5;
}

/* Responsywność */
@media (max-width: 768px) {
    .link-popup-content,
    .video-popup-content {
        width: 95%;
    }
}

/* ============================================
   PRZYPINANIE POSTÓW
   ============================================ */

/* Przycisk przypinania */
.post-pin {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.post-pin:hover {
    background: #f5f5f5;
    border-color: #219EC5;
    color: #219EC5;
}

.post-pin .pin-icon {
    font-size: 14px;
}

.post-pin .pin-text {
    font-weight: 500;
}

/* Post przypnięty */
.tablica-post.pinned-post {
    border: 2px solid #219EC5 !important;
    background: linear-gradient(135deg, #e6f7ff 0%, #fff 100%);
    box-shadow: 0 2px 12px rgba(33, 158, 197, 0.15);
}

.tablica-post.pinned-post:hover {
    box-shadow: 0 4px 16px rgba(33, 158, 197, 0.25);
}

/* Przycisk przypinania w przypniętym poście */
.tablica-post.pinned-post .post-pin {
    background: #e6f7ff;
    border-color: #219EC5;
    color: #219EC5;
}

.tablica-post.pinned-post .post-pin:hover {
    background: #cceeff;
}

/* Akcje posta - layout */
.post-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Responsywność */
@media (max-width: 768px) {
    .post-pin .pin-text {
        display: none;
    }
    
    .post-pin {
        padding: 6px 8px;
    }
}
