/* ==========================================================================
   WP Support Tickets - Frontend (Orange Theme like in image)
   ========================================================================== */

:root {
    --wpst-primary: #f97316;
    --wpst-primary-hover: #ea580c;
    --wpst-success: #10b981;
    --wpst-gray-50: #fafafa;
    --wpst-gray-100: #f5f5f5;
    --wpst-gray-200: #e5e5e5;
    --wpst-gray-400: #a3a3a3;
    --wpst-gray-500: #737373;
    --wpst-gray-700: #404040;
    --wpst-gray-800: #262626;
    --wpst-radius: 20px;
    --wpst-radius-sm: 12px;
}

/* ==========================================================================
   Base
   ========================================================================== */

/* Ukryj tytuły stron WordPress */
.wpst-tickets-wrapper + .entry-title,
.wpst-tickets-wrapper ~ .entry-title,
.wpst-ticket-form-wrapper + .entry-title,
.wpst-ticket-form-wrapper ~ .entry-title,
.wpst-single-ticket + .entry-title,
.wpst-single-ticket ~ .entry-title,
.wpst-login-required + .entry-title,
.wpst-login-required ~ .entry-title,
body.page .wpst-tickets-wrapper ~ h1,
body.page .wpst-ticket-form-wrapper ~ h1,
body.page .wpst-single-ticket ~ h1 {
    display: none !important;
}

/* Ukryj tytuł nad kontenerem wtyczki */
.entry-header:has(+ .entry-content .wpst-tickets-wrapper),
.entry-header:has(+ .entry-content .wpst-ticket-form-wrapper),
.entry-header:has(+ .entry-content .wpst-single-ticket),
.page-header:has(+ .wpst-tickets-wrapper),
.page-header:has(+ .wpst-ticket-form-wrapper),
.page-header:has(+ .wpst-single-ticket),
article.page header.entry-header,
.page .entry-title,
.page .page-title {
    display: none !important;
}

.wpst-login-required {
    text-align: center;
    padding: 40px;
    background: #fff;
    border-radius: var(--wpst-radius);
    box-shadow: 0 2px 20px rgba(0,0,0,0.06);
}

/* ==========================================================================
   Buttons (smaller - 75% size)
   ========================================================================== */
.wpst-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 18px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none !important;
    border-radius: var(--wpst-radius-sm);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    gap: 5px;
}

.wpst-btn-primary {
    background: var(--wpst-primary) !important;
    color: #fff !important;
}

.wpst-btn-primary:hover {
    background: var(--wpst-primary-hover) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(249,115,22,0.3);
}

.wpst-btn-icon {
    padding: 9px 12px;
    font-size: 14px;
    background: var(--wpst-gray-100);
    color: var(--wpst-gray-700);
}

.wpst-btn-icon:hover {
    background: var(--wpst-gray-200);
}

.wpst-spinning {
    animation: wpst-spin 1s linear infinite;
}

@keyframes wpst-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.wpst-btn-secondary {
    background: #fff !important;
    color: var(--wpst-gray-700) !important;
    border: 1px solid var(--wpst-gray-200) !important;
}

.wpst-btn-secondary:hover {
    background: var(--wpst-gray-100) !important;
}

.wpst-btn-send {
    width: 36px;
    height: 36px;
    padding: 0;
    font-size: 15px;
    border-radius: var(--wpst-radius-sm);
}

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

/* ==========================================================================
   Form
   ========================================================================== */
.wpst-ticket-form-wrapper {
    max-width: 600px;
    margin: 0 auto;
}

.wpst-ticket-form-wrapper .wpst-ticket-nav {
    margin-bottom: 16px;
}

.wpst-form {
    background: #fff;
    padding: 32px;
    border-radius: var(--wpst-radius);
    box-shadow: 0 2px 20px rgba(0,0,0,0.06);
}

.wpst-form-group {
    margin-bottom: 20px;
}

.wpst-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--wpst-gray-700);
    font-size: 14px;
}

.wpst-form-group input,
.wpst-form-group select,
.wpst-form-group textarea {
    width: 100%;
    padding: 14px 18px;
    font-size: 15px;
    border: none;
    border-radius: var(--wpst-radius-sm);
    background: var(--wpst-gray-100);
    box-sizing: border-box;
    transition: all 0.2s;
}

.wpst-form-group input:focus,
.wpst-form-group select:focus,
.wpst-form-group textarea:focus {
    outline: none;
    background: #fff;
    box-shadow: inset 0 0 0 2px var(--wpst-primary);
}

.wpst-form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.wpst-form-message {
    margin-top: 16px;
    padding: 14px;
    border-radius: var(--wpst-radius-sm);
    display: none;
    font-size: 14px;
}

.wpst-form-message.success {
    display: block;
    background: #ecfdf5;
    color: #065f46;
}

.wpst-form-message.error {
    display: block;
    background: #fef2f2;
    color: #991b1b;
}

/* ==========================================================================
   File Upload
   ========================================================================== */
.wpst-file-upload {
    margin-top: 8px;
}

.wpst-file-input {
    display: none;
}

.wpst-file-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--wpst-gray-100);
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--wpst-primary);
    font-weight: 500;
    transition: all 0.2s;
}

.wpst-file-label:hover {
    background: #fff8f5;
}

.wpst-file-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.wpst-file-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--wpst-gray-100);
    border-radius: 6px;
    font-size: 12px;
}

.wpst-file-remove {
    cursor: pointer;
    color: #ef4444;
    font-weight: bold;
}

.wpst-file-info {
    font-size: 11px;
    color: var(--wpst-gray-400);
    margin-top: 6px;
}

/* ==========================================================================
   Tickets List
   ========================================================================== */
.wpst-tickets-wrapper {
    max-width: 800px;
    margin: 0 auto;
}

.wpst-tickets-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 24px;
}

.wpst-tickets-header h3 {
    margin: 0;
    font-size: 24px;
    color: var(--wpst-gray-800);
}

.wpst-no-tickets {
    text-align: center;
    padding: 60px;
    background: #fff;
    border-radius: var(--wpst-radius);
    box-shadow: 0 2px 20px rgba(0,0,0,0.06);
    color: var(--wpst-gray-500);
}

.wpst-tickets-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 20px rgba(0,0,0,0.06);
    font-size: 13px;
}

.wpst-tickets-table th,
.wpst-tickets-table td {
    padding: 12px 15px;
    text-align: center;
}

.wpst-tickets-table th.wpst-col-id,
.wpst-tickets-table td.wpst-col-id {
    width: 60px;
    text-align: center;
}

.wpst-tickets-table th.wpst-col-status,
.wpst-tickets-table td.wpst-col-status {
    width: 90px;
    text-align: center;
}

.wpst-tickets-table th.wpst-col-subject,
.wpst-tickets-table td.wpst-col-subject {
    width: auto;
    text-align: left;
}

.wpst-tickets-table th.wpst-col-date,
.wpst-tickets-table td.wpst-col-date {
    width: 100px;
    text-align: center;
    font-size: 12px;
    white-space: nowrap;
}

.wpst-tickets-table th {
    background: var(--wpst-gray-50);
    font-weight: 600;
    color: var(--wpst-gray-500);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wpst-tickets-table td {
    border-top: 1px solid var(--wpst-gray-100);
}

.wpst-tickets-table tbody tr:hover {
    background: #fffaf5;
}

.wpst-tickets-table a {
    color: var(--wpst-primary);
    text-decoration: none;
    font-weight: 600;
}

/* Status */
.wpst-status {
    display: inline-block;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 20px;
    text-transform: uppercase;
}

.wpst-status-open { background: #dbeafe; color: #1e40af; }
.wpst-status-in_progress { background: #fef3c7; color: #92400e; }
.wpst-status-waiting { background: #e0e7ff; color: #3730a3; }
.wpst-status-closed { background: var(--wpst-gray-200); color: var(--wpst-gray-500); }

/* Green dot for new replies */
.wpst-new-badge {
    display: inline-block;
    width: 10px;
    height: 10px;
    background: var(--wpst-success);
    border-radius: 50%;
    margin-left: 8px;
    vertical-align: middle;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.5); }
    50% { box-shadow: 0 0 0 8px rgba(16,185,129,0); }
}

/* ==========================================================================
   Single Ticket
   ========================================================================== */
.wpst-single-ticket {
    max-width: 700px;
    margin: 0 auto;
}

.wpst-ticket-nav {
    margin-bottom: 16px;
}

.wpst-ticket-header {
    background: #fff;
    padding: 24px;
    border-radius: var(--wpst-radius);
    box-shadow: 0 2px 20px rgba(0,0,0,0.06);
    margin-bottom: 20px;
}

.wpst-ticket-header h2 {
    margin: 0 0 12px;
    font-size: 20px;
    color: var(--wpst-gray-800);
}

.wpst-ticket-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.wpst-ticket-meta .wpst-topic,
.wpst-ticket-meta .wpst-date {
    color: var(--wpst-gray-500);
    font-size: 13px;
}

/* ==========================================================================
   Messages - Style like in the image
   ========================================================================== */
.wpst-ticket-conversation {
    margin-bottom: 20px;
}

.wpst-message {
    background: #fff;
    padding: 14px 18px;
    border-radius: var(--wpst-radius);
    box-shadow: 0 2px 20px rgba(0,0,0,0.06);
    margin-bottom: 10px;
}

.wpst-message-user {
    /* User message - clean white */
}

.wpst-message-admin {
    /* Admin message - subtle orange tint */
    background: linear-gradient(135deg, #fffaf5 0%, #fff 100%);
    border-left: 3px solid var(--wpst-primary);
}

.wpst-message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.wpst-message-header strong {
    color: var(--wpst-gray-800);
    font-size: 14px;
}

.wpst-message-date {
    color: var(--wpst-gray-400);
    font-size: 12px;
}

.wpst-message-content {
    color: var(--wpst-gray-700);
    line-height: 1.5;
    font-size: 14px;
}

.wpst-message-content p {
    margin: 0 0 6px;
}

.wpst-message-content p:last-child {
    margin: 0;
}

/* Attachments */
.wpst-message-attachments {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--wpst-gray-100);
}

.wpst-attachment {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--wpst-gray-100);
    border-radius: 6px;
    font-size: 13px;
    color: var(--wpst-gray-700);
    text-decoration: none !important;
    margin-right: 8px;
    margin-bottom: 8px;
}

.wpst-attachment:hover {
    background: var(--wpst-gray-200);
}

.wpst-attachment-image {
    max-width: 200px;
    border-radius: 8px;
    margin-top: 8px;
}

/* ==========================================================================
   Reply Form - Like in the image (minimalist)
   ========================================================================== */
.wpst-reply-form-wrapper {
    background: #fff;
    padding: 20px 24px;
    border-radius: var(--wpst-radius);
    box-shadow: 0 2px 20px rgba(0,0,0,0.06);
}

#reply_content {
    width: 100%;
    padding: 16px;
    font-size: 15px;
    border: none;
    background: var(--wpst-gray-100);
    border-radius: var(--wpst-radius-sm);
    resize: none;
    min-height: 60px;
    box-sizing: border-box;
    font-family: inherit;
}

#reply_content:focus {
    outline: none;
    background: #fff;
    box-shadow: inset 0 0 0 2px var(--wpst-primary);
}

#reply_content::placeholder {
    color: var(--wpst-gray-400);
}

.wpst-form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 14px;
    gap: 12px;
}

.wpst-form-actions-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wpst-form-actions-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Mniejsze przyciski w oknie konwersacji */
.wpst-form-actions-right .wpst-btn {
    padding: 7px 14px;
    font-size: 10px;
}

.wpst-form-actions-right .wpst-btn-icon {
    padding: 7px 10px;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.wpst-form-actions-right .wpst-btn-send {
    width: 29px;
    height: 29px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================================================
   Closed Notice
   ========================================================================== */
.wpst-ticket-closed-notice {
    background: var(--wpst-gray-100);
    padding: 24px;
    border-radius: var(--wpst-radius);
    text-align: center;
}

.wpst-ticket-closed-notice p {
    margin: 0;
    color: var(--wpst-gray-500);
}

/* ==========================================================================
   Error
   ========================================================================== */
.wpst-error {
    background: #fef2f2;
    color: #991b1b;
    padding: 20px;
    border-radius: var(--wpst-radius);
}

/* ==========================================================================
   New Message Indicator
   ========================================================================== */
.wpst-new-message-indicator {
    background: var(--wpst-primary);
    color: #fff;
    padding: 12px;
    border-radius: var(--wpst-radius-sm);
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 12px;
    cursor: pointer;
}

.wpst-new-reply {
    animation: highlight 2s ease-out;
}

@keyframes highlight {
    from { box-shadow: 0 0 0 3px rgba(249,115,22,0.4); }
    to { box-shadow: 0 2px 20px rgba(0,0,0,0.06); }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
    .wpst-tickets-header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
    
    .wpst-form-actions {
        flex-direction: column;
    }
    
    .wpst-form-actions-left,
    .wpst-form-actions-right {
        width: 100%;
        justify-content: center;
    }
    
    .wpst-form-row {
        flex-direction: column;
    }
    
    .wpst-form-half {
        width: 100% !important;
    }
}

/* ==========================================================================
   Guest Fields
   ========================================================================== */
.wpst-guest-fields {
    background: #fefce8;
    border: 1px solid #fef08a;
    border-radius: var(--wpst-radius);
    padding: 20px;
    margin-bottom: 24px;
}

.wpst-form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 0;
}

.wpst-form-half {
    flex: 1;
    width: 50%;
}

.wpst-guest-info {
    margin: 16px 0 0 0;
    padding: 12px;
    background: #fff;
    border-radius: 8px;
    font-size: 13px;
    color: #92400e;
    text-align: center;
}

/* ==========================================================================
   Guest Login
   ========================================================================== */
.wpst-guest-login-wrapper {
    max-width: 450px;
    margin: 0 auto;
}

.wpst-guest-login-box {
    background: #fff;
    border-radius: var(--wpst-radius);
    box-shadow: 0 2px 20px rgba(0,0,0,0.06);
    padding: 32px;
}

.wpst-guest-login-box h3 {
    margin: 0 0 8px 0;
    font-size: 20px;
    color: var(--wpst-gray-900);
}

.wpst-guest-login-box > p {
    margin: 0 0 24px 0;
    color: var(--wpst-gray-500);
    font-size: 14px;
}

.wpst-guest-login-footer {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--wpst-gray-100);
    text-align: center;
}

.wpst-guest-login-footer p {
    margin: 0 0 12px 0;
    color: var(--wpst-gray-500);
    font-size: 14px;
}

/* ==========================================================================
   Guest Info Bar
   ========================================================================== */
.wpst-guest-info-bar {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: var(--wpst-radius);
    padding: 12px 16px;
    margin-bottom: 20px;
    color: #065f46;
    font-size: 13px;
}

.wpst-btn-logout {
    font-size: 11px !important;
    padding: 6px 12px !important;
}
