/**
 * Developer Helpdesk - Frontend Styles
 */

/* ============================================
   CSS Custom Properties
   ============================================ */
:root {
    --dev-helpdesk-primary: #0073aa;
    --dev-helpdesk-primary-dark: #005a87;
    --dev-helpdesk-success: #28a745;
    --dev-helpdesk-warning: #ffc107;
    --dev-helpdesk-danger: #dc3545;
    --dev-helpdesk-info: #17a2b8;
    --dev-helpdesk-light: #f8f9fa;
    --dev-helpdesk-dark: #343a40;
    --dev-helpdesk-gray: #6c757d;
    --dev-helpdesk-border: #dee2e6;
    --dev-helpdesk-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --dev-helpdesk-radius: 8px;
    --dev-helpdesk-radius-lg: 12px;
    --dev-helpdesk-transition: 0.2s ease;
    --dev-helpdesk-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ============================================
   Base Styles
   ============================================ */
.dev-helpdesk-form-wrapper,
.dev-helpdesk-my-tickets,
.dev-helpdesk-knowledge-base,
.dev-helpdesk-faq-search,
.dev-helpdesk-faq-list,
.dev-helpdesk-faq-accordion,
.dev-helpdesk-contact-form,
.dev-helpdesk-single-faq {
    font-family: var(--dev-helpdesk-font);
    line-height: 1.6;
    color: var(--dev-helpdesk-dark);
}

.section-title,
.form-title {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--dev-helpdesk-dark);
}

/* ============================================
   Form Styles
   ============================================ */
.dev-helpdesk-form {
    max-width: 700px;
    background: #fff;
    padding: 30px;
    border-radius: var(--dev-helpdesk-radius-lg);
    box-shadow: var(--dev-helpdesk-shadow);
}

.form-field {
    margin-bottom: 20px;
}

.form-field label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--dev-helpdesk-dark);
}

.form-field label .required {
    color: var(--dev-helpdesk-danger);
}

.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="url"],
.form-field input[type="tel"],
.form-field input[type="number"],
.form-field select,
.form-field textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--dev-helpdesk-border);
    border-radius: var(--dev-helpdesk-radius);
    font-size: 15px;
    font-family: inherit;
    transition: border-color var(--dev-helpdesk-transition), box-shadow var(--dev-helpdesk-transition);
    box-sizing: border-box;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    outline: none;
    border-color: var(--dev-helpdesk-primary);
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.15);
}

.form-field textarea {
    resize: vertical;
    min-height: 120px;
}

.form-field input[type="file"] {
    padding: 10px;
    background: var(--dev-helpdesk-light);
    border: 2px dashed var(--dev-helpdesk-border);
    border-radius: var(--dev-helpdesk-radius);
    cursor: pointer;
}

.field-hint {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: var(--dev-helpdesk-gray);
}

.form-row {
    display: flex;
    gap: 20px;
}

.form-row-half .form-field {
    flex: 1;
}

.form-row-third .form-field {
    flex: 1;
}

@media (max-width: 600px) {
    .form-row {
        flex-direction: column;
        gap: 0;
    }
}

.form-submit {
    margin-top: 25px;
}

.submit-btn {
    display: inline-block;
    padding: 14px 32px;
    background: var(--dev-helpdesk-primary);
    color: #fff;
    border: none;
    border-radius: var(--dev-helpdesk-radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--dev-helpdesk-transition), transform var(--dev-helpdesk-transition);
}

.submit-btn:hover {
    background: var(--dev-helpdesk-primary-dark);
    transform: translateY(-1px);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Form Messages */
.form-messages,
.form-success,
.form-error {
    padding: 15px 20px;
    border-radius: var(--dev-helpdesk-radius);
    margin-bottom: 20px;
}

.form-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.form-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ============================================
   Tickets Table
   ============================================ */
.tickets-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: var(--dev-helpdesk-radius-lg);
    overflow: hidden;
    box-shadow: var(--dev-helpdesk-shadow);
}

.tickets-table thead {
    background: var(--dev-helpdesk-light);
}

.tickets-table th {
    padding: 15px 20px;
    text-align: left;
    font-weight: 600;
    color: var(--dev-helpdesk-dark);
    border-bottom: 2px solid var(--dev-helpdesk-border);
}

.tickets-table td {
    padding: 15px 20px;
    border-bottom: 1px solid var(--dev-helpdesk-border);
}

.tickets-table tbody tr:last-child td {
    border-bottom: none;
}

.tickets-table tbody tr:hover {
    background: var(--dev-helpdesk-light);
}

.tickets-table a {
    color: var(--dev-helpdesk-primary);
    text-decoration: none;
}

.tickets-table a:hover {
    text-decoration: underline;
}

.ticket-number a {
    font-weight: 600;
    font-family: monospace;
}

/* Status & Priority Badges */
.ticket-status-badge,
.ticket-priority-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

/* ============================================
   Knowledge Base
   ============================================ */
.kb-search {
    max-width: 600px;
    margin: 0 auto 40px;
}

.kb-search form {
    display: flex;
    background: #fff;
    border-radius: 50px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.kb-search input[type="text"] {
    flex: 1;
    padding: 18px 25px;
    border: none;
    font-size: 16px;
    outline: none;
}

.kb-search button {
    padding: 0 25px;
    background: var(--dev-helpdesk-primary);
    color: #fff;
    border: none;
    cursor: pointer;
    transition: background var(--dev-helpdesk-transition);
}

.kb-search button:hover {
    background: var(--dev-helpdesk-primary-dark);
}

.kb-topics {
    display: grid;
    grid-template-columns: repeat(var(--columns, 3), 1fr);
    gap: 25px;
}

@media (max-width: 900px) {
    .kb-topics {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .kb-topics {
        grid-template-columns: 1fr;
    }
}

.kb-topic-card {
    background: #fff;
    padding: 30px;
    border-radius: var(--dev-helpdesk-radius-lg);
    box-shadow: var(--dev-helpdesk-shadow);
    transition: transform var(--dev-helpdesk-transition), box-shadow var(--dev-helpdesk-transition);
}

.kb-topic-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.topic-icon {
    width: 60px;
    height: 60px;
    background: var(--dev-helpdesk-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    color: var(--dev-helpdesk-primary);
}

.topic-name {
    font-size: 1.25rem;
    margin: 0 0 10px;
}

.topic-name a {
    color: var(--dev-helpdesk-dark);
    text-decoration: none;
}

.topic-name a:hover {
    color: var(--dev-helpdesk-primary);
}

.topic-description {
    color: var(--dev-helpdesk-gray);
    margin: 0 0 15px;
    font-size: 14px;
}

.article-count {
    display: inline-block;
    font-size: 13px;
    color: var(--dev-helpdesk-gray);
    background: var(--dev-helpdesk-light);
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 15px;
}

.topic-articles {
    list-style: none;
    padding: 0;
    margin: 0;
    border-top: 1px solid var(--dev-helpdesk-border);
    padding-top: 15px;
}

.topic-articles li {
    padding: 8px 0;
}

.topic-articles a {
    color: var(--dev-helpdesk-dark);
    text-decoration: none;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.topic-articles a:before {
    content: "→";
    color: var(--dev-helpdesk-primary);
}

.topic-articles a:hover {
    color: var(--dev-helpdesk-primary);
}

/* ============================================
   FAQ List
   ============================================ */
.faq-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.faq-list-item {
    border-bottom: 1px solid var(--dev-helpdesk-border);
}

.faq-list-item:last-child {
    border-bottom: none;
}

.faq-list-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 0;
    color: var(--dev-helpdesk-dark);
    text-decoration: none;
    transition: color var(--dev-helpdesk-transition);
}

.faq-list-item a:hover {
    color: var(--dev-helpdesk-primary);
}

.faq-icon {
    color: var(--dev-helpdesk-primary);
    flex-shrink: 0;
}

/* ============================================
   FAQ Accordion
   ============================================ */
.dev-helpdesk-faq-accordion {
    max-width: 800px;
}

.accordion-item {
    background: #fff;
    border: 1px solid var(--dev-helpdesk-border);
    border-radius: var(--dev-helpdesk-radius);
    margin-bottom: 10px;
    overflow: hidden;
}

.accordion-header {
    width: 100%;
    padding: 18px 20px;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
    font-size: 16px;
    font-weight: 500;
    color: var(--dev-helpdesk-dark);
    transition: background var(--dev-helpdesk-transition);
}

.accordion-header:hover {
    background: var(--dev-helpdesk-light);
}

.accordion-icon {
    transition: transform var(--dev-helpdesk-transition);
    color: var(--dev-helpdesk-gray);
}

.accordion-item.open .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    padding: 0 20px 20px;
    color: var(--dev-helpdesk-gray);
    line-height: 1.7;
}

/* ============================================
   Ticket Single View
   ============================================ */
.dev-helpdesk-ticket-single {
    max-width: 900px;
    margin: 0 auto;
}

.ticket-header {
    background: #fff;
    padding: 30px;
    border-radius: var(--dev-helpdesk-radius-lg);
    box-shadow: var(--dev-helpdesk-shadow);
    margin-bottom: 30px;
}

.ticket-title {
    font-size: 1.5rem;
    margin: 0 0 15px;
    color: var(--dev-helpdesk-dark);
}

.ticket-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    color: var(--dev-helpdesk-gray);
    font-size: 14px;
}

.ticket-meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.ticket-content {
    background: #fff;
    padding: 30px;
    border-radius: var(--dev-helpdesk-radius-lg);
    box-shadow: var(--dev-helpdesk-shadow);
    margin-bottom: 30px;
    line-height: 1.7;
}

/* Ticket Replies */
.ticket-replies {
    margin-bottom: 30px;
}

.ticket-replies h3 {
    margin-bottom: 20px;
}

.reply-item {
    background: #fff;
    padding: 25px;
    border-radius: var(--dev-helpdesk-radius);
    box-shadow: var(--dev-helpdesk-shadow);
    margin-bottom: 15px;
}

.reply-item.agent-reply {
    border-left: 4px solid var(--dev-helpdesk-primary);
}

.reply-item.user-reply {
    border-left: 4px solid var(--dev-helpdesk-success);
}

.reply-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--dev-helpdesk-border);
}

.reply-author {
    font-weight: 600;
    color: var(--dev-helpdesk-dark);
}

.reply-date {
    font-size: 13px;
    color: var(--dev-helpdesk-gray);
}

.reply-content {
    line-height: 1.7;
}

/* Reply Form */
.ticket-reply-form {
    background: #fff;
    padding: 30px;
    border-radius: var(--dev-helpdesk-radius-lg);
    box-shadow: var(--dev-helpdesk-shadow);
}

.ticket-reply-form h3 {
    margin: 0 0 20px;
}

/* ============================================
   FAQ Single View
   ============================================ */
.dev-helpdesk-faq-single {
    max-width: 800px;
    margin: 0 auto;
}

.faq-header {
    margin-bottom: 30px;
}

.faq-title {
    font-size: 2rem;
    margin: 0 0 15px;
    color: var(--dev-helpdesk-dark);
}

.faq-meta {
    display: flex;
    gap: 20px;
    color: var(--dev-helpdesk-gray);
    font-size: 14px;
}

.faq-content {
    background: #fff;
    padding: 40px;
    border-radius: var(--dev-helpdesk-radius-lg);
    box-shadow: var(--dev-helpdesk-shadow);
    line-height: 1.8;
}

.faq-content h2,
.faq-content h3,
.faq-content h4 {
    margin-top: 30px;
    margin-bottom: 15px;
}

.faq-content p {
    margin-bottom: 15px;
}

.faq-content ul,
.faq-content ol {
    margin-bottom: 15px;
    padding-left: 25px;
}

.faq-content code {
    background: var(--dev-helpdesk-light);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 14px;
}

.faq-content pre {
    background: var(--dev-helpdesk-dark);
    color: #fff;
    padding: 20px;
    border-radius: var(--dev-helpdesk-radius);
    overflow-x: auto;
}

.faq-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

/* Helpful Voting */
.faq-helpful {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--dev-helpdesk-border);
    text-align: center;
}

.faq-helpful p {
    margin-bottom: 15px;
    font-size: 16px;
}

.helpful-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.helpful-btn {
    padding: 12px 30px;
    border: 2px solid var(--dev-helpdesk-border);
    background: #fff;
    border-radius: var(--dev-helpdesk-radius);
    font-size: 15px;
    cursor: pointer;
    transition: all var(--dev-helpdesk-transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.helpful-btn:hover {
    border-color: var(--dev-helpdesk-primary);
    color: var(--dev-helpdesk-primary);
}

.helpful-btn.voted {
    background: var(--dev-helpdesk-primary);
    border-color: var(--dev-helpdesk-primary);
    color: #fff;
}

/* Related Articles */
.related-articles {
    margin-top: 40px;
}

.related-articles h3 {
    margin-bottom: 20px;
}

.related-articles ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.related-articles li {
    margin-bottom: 10px;
}

.related-articles a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--dev-helpdesk-dark);
    text-decoration: none;
    padding: 12px 15px;
    background: #fff;
    border-radius: var(--dev-helpdesk-radius);
    transition: background var(--dev-helpdesk-transition);
}

.related-articles a:hover {
    background: var(--dev-helpdesk-light);
    color: var(--dev-helpdesk-primary);
}

/* ============================================
   Pagination
   ============================================ */
.pagination {
    margin-top: 30px;
    display: flex;
    justify-content: center;
    gap: 5px;
}

.pagination a,
.pagination span {
    display: inline-block;
    padding: 10px 15px;
    border-radius: var(--dev-helpdesk-radius);
    text-decoration: none;
    transition: all var(--dev-helpdesk-transition);
}

.pagination a {
    background: #fff;
    color: var(--dev-helpdesk-dark);
    border: 1px solid var(--dev-helpdesk-border);
}

.pagination a:hover {
    background: var(--dev-helpdesk-primary);
    color: #fff;
    border-color: var(--dev-helpdesk-primary);
}

.pagination .current {
    background: var(--dev-helpdesk-primary);
    color: #fff;
}

/* ============================================
   Notice
   ============================================ */
.dev-helpdesk-notice {
    padding: 20px 25px;
    background: var(--dev-helpdesk-light);
    border-radius: var(--dev-helpdesk-radius);
    border-left: 4px solid var(--dev-helpdesk-info);
}

.dev-helpdesk-notice a {
    color: var(--dev-helpdesk-primary);
    font-weight: 500;
}

/* ============================================
   No Content
   ============================================ */
.no-tickets,
.no-content {
    text-align: center;
    padding: 50px 30px;
    background: var(--dev-helpdesk-light);
    border-radius: var(--dev-helpdesk-radius-lg);
}

.no-tickets p,
.no-content p {
    color: var(--dev-helpdesk-gray);
    margin: 0;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .dev-helpdesk-form {
        padding: 20px;
    }
    
    .tickets-table {
        display: block;
        overflow-x: auto;
    }
    
    .ticket-header,
    .ticket-content,
    .faq-content {
        padding: 20px;
    }
    
    .faq-title {
        font-size: 1.5rem;
    }
}
