/* Custom Support Tickets - User Panel Styles */

.cst-user-panel {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: transparent;
    min-height: 80vh;
}

/* Restricción de administradores */
.cst-admin-restricted {
    max-width: 600px;
    margin: 50px auto;
    padding: 40px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    text-align: center;
    border-left: 4px solid #ff6b35;
}

.cst-admin-restricted h3 {
    color: #d63638;
    margin-bottom: 15px;
    font-size: 24px;
}

.cst-admin-restricted p {
    color: #646970;
    margin-bottom: 25px;
    font-size: 16px;
    line-height: 1.6;
}

/* Navigation */
.cst-panel-nav {
    margin-bottom: 30px;
}

.cst-nav-tabs {
    display: flex;
    background: #fff;
    border-radius: 12px;
    padding: 10px;
    gap: 10px;
    margin: 0;
    list-style: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow-x: auto;
}

.cst-nav-tabs li {
    flex: 1;
    min-width: 120px;
}

.cst-nav-tabs li a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 8px;
    text-decoration: none;
    color: #646970;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
}

.cst-nav-tabs li.active a,
.cst-nav-tabs li a:hover {
    background: #007cba;
    color: white;
}

.cst-count-badge {
    background: #dc3545;
    color: white;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    line-height: 1.2;
}

.cst-nav-tabs li.active .cst-count-badge {
    background: rgba(255,255,255,0.2);
}

/* Panel Content */
.cst-panel-content {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    min-height: 500px;
}

/* Dashboard Section */
.cst-dashboard-section h2 {
    margin-top: 0;
    margin-bottom: 25px;
    color: #1d2327;
}

.cst-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.cst-stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    transition: transform 0.3s ease;
}

.cst-stat-card:hover {
    transform: translateY(-5px);
}

.cst-stat-card.cst-stat-open {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.cst-stat-card.cst-stat-progress {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.cst-stat-card.cst-stat-resolved {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.cst-stat-number {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 8px;
}

.cst-stat-label {
    font-size: 14px;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Recent Tickets */
.cst-recent-tickets h3 {
    margin-bottom: 20px;
    color: #1d2327;
}

.cst-tickets-preview {
    margin-bottom: 25px;
}

.cst-ticket-preview-item {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.cst-ticket-preview-item:hover {
    border-color: #007cba;
    box-shadow: 0 2px 8px rgba(0,124,186,0.1);
}

.cst-ticket-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.cst-ticket-preview-header h4 {
    margin: 0;
    font-size: 16px;
}

.cst-ticket-preview-header h4 a {
    color: #007cba;
    text-decoration: none;
}

.cst-ticket-preview-header h4 a:hover {
    text-decoration: underline;
}

.cst-ticket-preview-meta {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    font-size: 13px;
    color: #646970;
}

/* Tickets Grid */
.cst-tickets-section {
    margin-top: 0;
}

.cst-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.cst-section-header h2 {
    margin: 0;
    color: #1d2327;
}

.cst-simple-filters {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.cst-filter-select,
.cst-search-input {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    min-width: 150px;
}

.cst-search-input {
    flex: 1;
    max-width: 300px;
}

.cst-tickets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.cst-ticket-card {
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    background: #fff;
    transition: all 0.3s ease;
    overflow: hidden;
}

.cst-ticket-card:hover {
    border-color: #007cba;
    box-shadow: 0 4px 12px rgba(0,124,186,0.15);
    transform: translateY(-2px);
}

.cst-ticket-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.cst-ticket-id {
    font-weight: 600;
    color: #646970;
    font-size: 13px;
}

.cst-ticket-card-content {
    padding: 20px;
}

.cst-ticket-title {
    margin: 0 0 12px 0;
    font-size: 16px;
    line-height: 1.4;
}

.cst-ticket-title a {
    color: #1d2327;
    text-decoration: none;
}

.cst-ticket-title a:hover {
    color: #007cba;
}

.cst-ticket-excerpt {
    color: #646970;
    font-size: 14px;
    line-height: 1.5;
}

.cst-ticket-card-footer {
    padding: 15px 20px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column-reverse;
    flex-wrap: nowrap;
    gap: 10px;
    justify-content: space-between;
    align-items: center;
}

.cst-ticket-meta {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.cst-ticket-date {
    font-size: 12px;
    color: #8c8f94;
}

/* Status and Priority Badges */
.cst-status-badge, .cst-priority-badge, .cst-category-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cst-status-open { background: #e3f2fd; color: #1976d2; }
.cst-status-in-progress { background: #fff3e0; color: #f57c00; }
.cst-status-waiting { background: #fce4ec; color: #c2185b; }
.cst-status-resolved { background: #e8f5e8; color: #388e3c; }
.cst-status-closed { background: #f5f5f5; color: #757575; }

.cst-priority-baja { background: #e8f5e8; color: #2e7d32; }
.cst-priority-media { background: #fff3e0; color: #ef6c00; }
.cst-priority-alta { background: #ffebee; color: #c62828; }
.cst-priority-urgente { 
    background: #fce4ec; 
    color: #ad1457; 
    animation: pulse 2s infinite;
}

.cst-category-badge {
    background: rgba(0,124,186,0.1);
    border: 1px solid currentColor;
}

.cst-reply-count {
    background: #007cba;
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
}

.cst-staff-badge {
    background: #28a745;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    margin-left: 8px;
}

/* Form Styles */
.cst-user-ticket-form {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 12px;
    margin-top: 20px;
}

.cst-form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 0;
}

.cst-form-group {
    margin-bottom: 20px;
}

.cst-form-group.cst-half {
    flex: 1;
}

.cst-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #1d2327;
}

.cst-form-group input,
.cst-form-group select,
.cst-form-group textarea {
    width: 100%;
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.cst-form-group input:focus,
.cst-form-group select:focus,
.cst-form-group textarea:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.cst-form-group textarea {
    resize: none;
    min-height: 120px;
}

.cst-form-group small {
    display: block;
    margin-top: 5px;
    color: #646970;
    font-size: 12px;
}

.cst-char-counter {
    text-align: right;
    color: #8c8f94;
}

.cst-char-counter.cst-warning { color: #ff6600; }
.cst-char-counter.cst-danger { color: #dc3232; }

/* Buttons */
.cst-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    justify-content: center;
}

.cst-btn-primary {
    background: #007cba !important;
    color: #030408 !important;
    border: 1px solid #007cba !important;
}

.cst-btn-primary:hover {
    background: #007cba !important;
    color: #030408 !important;
    border: 1px solid #007cba !important;
    transform: translateY(-1px);
}

.cst-btn-secondary {
    background: #e9ecef !important;
    color: #030408 !important;
    border: 1px solid #007cba !important;
}

.cst-btn-secondary:hover {
    background: #e9ecef !important;
    color: #030408 !important;
    border: 1px solid #007cba !important;
}

.cst-btn-large {
    padding: 15px 30px;
    font-size: 16px;
}

.cst-form-actions {
    margin-top: 25px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* Ticket View */
.cst-ticket-view-section {
    max-width: none;
}

.cst-ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.cst-ticket-title-section h2 {
    margin: 0 0 10px 0;
    color: #1d2327;
    font-size: 24px;
}

.cst-ticket-id {
    color: #646970;
    font-weight: 600;
}

.cst-ticket-meta-section {
    text-align: right;
}

.cst-ticket-badges {
    margin-bottom: 15px;
}

.cst-ticket-badges > * {
    margin-left: 8px;
}

.cst-ticket-dates {
    font-size: 13px;
    color: #646970;
}

.cst-ticket-dates > div {
    margin-bottom: 5px;
}

.cst-original-message {
    background: #f8f9fa;
    border-left: 4px solid #007cba;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.cst-original-message h3 {
    margin: 0 0 15px 0;
    color: #1d2327;
}

.cst-message-content {
    line-height: 1.6;
    color: #495057;
}

/* Replies */
.cst-replies-section {
    margin-bottom: 30px;
}

.cst-replies-section h3 {
    margin-bottom: 20px;
    color: #1d2327;
}

.cst-reply {
    margin-bottom: 20px;
    padding: 20px;
    border-radius: 12px;
    position: relative;
}

.cst-reply-customer {
    background: #f0f8ff;
    border-left: 4px solid #007cba;
    margin-right: 40px;
}

.cst-reply-admin {
    background: #f0fff0;
    border-left: 4px solid #28a745;
    margin-left: 40px;
}

.cst-reply-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.cst-reply-author {
    display: flex;
    align-items: center;
    font-weight: 600;
    color: #1d2327;
}

.cst-reply-date {
    color: #8c8f94;
    font-size: 13px;
}

.cst-reply-content {
    line-height: 1.6;
    color: #495057;
}

.cst-no-replies {
    text-align: center;
    padding: 40px 20px;
    color: #646970;
    font-style: italic;
}

/* Reply Form */
.cst-reply-form-section {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 30px;
}

.cst-reply-form-section h3 {
    margin: 0 0 20px 0;
    color: #1d2327;
}

/* Attachments */
.cst-attachments {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.cst-attachments h4 {
    margin: 0 0 10px 0;
    color: #1d2327;
    font-size: 14px;
}

.cst-attachment {
    display: inline-block;
    margin-right: 15px;
    margin-bottom: 8px;
    padding: 6px 12px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    text-decoration: none;
    color: #007cba;
    font-size: 13px;
    transition: all 0.3s ease;
}

.cst-attachment:hover {
    background: #f8f9fa;
    border-color: #007cba;
    color: #005a87;
}

.cst-attachment small {
    color: #8c8f94;
    margin-left: 5px;
}

.cst-reply-attachments {
    margin-top: 10px;
}

/* Estilos específicos para imágenes */
.cst-attachment[href*=".jpg"], 
.cst-attachment[href*=".jpeg"], 
.cst-attachment[href*=".png"] {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 20%);
    color: white;
    border-color: transparent;
}

.cst-attachment[href*=".jpg"]:hover, 
.cst-attachment[href*=".jpeg"]:hover, 
.cst-attachment[href*=".png"]:hover {
    background: linear-gradient(135deg, #e082ea 0%, #e4465b 20%);
    color: white;
}

/* Profile Section */
.cst-profile-section {
    text-align: center;
}

.cst-profile-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    margin-bottom: 30px;
    padding: 30px;
    background: #f8f9fa;
    border-radius: 12px;
}

.cst-profile-avatar img {
    border-radius: 50%;
    border: 4px solid #007cba;
}

.cst-profile-details {
    text-align: left;
}

.cst-profile-details h3 {
    margin: 0 0 10px 0;
    color: #1d2327;
    font-size: 24px;
}

.cst-profile-details p {
    margin: 5px 0;
    color: #646970;
}

.cst-profile-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* No Tickets State */
.cst-no-tickets {
    text-align: center;
    padding: 60px 20px;
    color: #646970;
}

.cst-no-tickets-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.cst-no-tickets h3 {
    margin: 0 0 15px 0;
    color: #1d2327;
    font-size: 24px;
}

.cst-no-tickets p {
    margin: 0 0 25px 0;
    font-size: 16px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* Error Messages */
.cst-error-message {
    text-align: center;
    padding: 40px 20px;
}

.cst-error-message h3 {
    color: #dc3545;
    margin-bottom: 15px;
}

.cst-error-message p {
    color: #646970;
    margin-bottom: 25px;
}

/* Ticket Closed Notice */
.cst-ticket-closed-notice {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

/* Ticket Actions */
.cst-ticket-actions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

/* View All Button */
.cst-view-all {
    text-align: center;
    margin-top: 25px;
}

/* Messages and Loading */
.cst-messages {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 400px;
}

.cst-message {
    padding: 15px 20px;
    margin-bottom: 10px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: slideInRight 0.3s ease;
    position: relative;
    padding-right: 45px;
}

.cst-message-close {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.cst-message-close:hover {
    opacity: 1;
}

.cst-message-success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.cst-message-error {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.cst-message-info {
    background: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.cst-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.cst-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Layout de dos columnas */
.cst-two-column-layout {
    display: flex;
    gap: 25px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.cst-column-left {
    flex: 1;
    min-width: 350px;
}

.cst-column-right {
    flex: 1;
    min-width: 350px;
    position: sticky;
    top: 20px;
}

.cst-new-ticket-container {
    background: #f8f9fa;
    border: 2px solid #007cba;
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.15);
}

.cst-new-ticket-container .cst-new-ticket-section {
    background: transparent;
    padding: 25px;
    border-radius: 0;
    margin: 0;
}

.cst-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.cst-form-header h2 {
    margin: 0;
    color: #1d2327;
    font-size: 20px;
}

.cst-close-form-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.cst-close-form-btn:hover {
    background: #c82333;
    transform: translateY(-1px);
}

.cst-close-form-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Ajustes para el botón de crear nuevo ticket */
#cst-toggle-new-ticket,
#cst-toggle-new-ticket-empty {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

#cst-toggle-new-ticket .dashicons,
#cst-toggle-new-ticket-empty .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .cst-user-panel {
        padding: 15px;
    }
    
    .cst-tickets-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 15px;
    }
    
    .cst-stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .cst-user-panel {
        padding: 10px;
    }

    .cst-panel-content {
        padding: 20px 15px;
    }

    .cst-nav-tabs {
        flex-direction: column;
        padding: 0;
    }

    .cst-nav-tabs li {
        width: 100%;
    }

    .cst-nav-tabs li a {
        justify-content: flex-start;
        padding: 15px 20px;
        border-radius: 0;
    }

    .cst-nav-tabs li:first-child a {
        border-radius: 12px 12px 0 0;
    }

    .cst-nav-tabs li:last-child a {
        border-radius: 0 0 12px 12px;
    }

    .cst-tickets-grid {
        grid-template-columns: 1fr;
    }

    /* Layout de dos columnas en móvil */
    .cst-two-column-layout {
        flex-direction: column;
        gap: 20px;
    }

    .cst-column-left,
    .cst-column-right {
        min-width: 100%;
        width: 100%;
    }

    .cst-column-right {
        position: relative;
        top: 0;
    }
    
    .cst-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .cst-form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .cst-ticket-header {
        flex-direction: column;
        gap: 20px;
    }
    
    .cst-ticket-meta-section {
        text-align: left;
    }
    
    .cst-reply-customer {
        margin-right: 20px;
    }
    
    .cst-reply-admin {
        margin-left: 20px;
    }
    
    .cst-simple-filters {
        flex-direction: column;
    }
    
    .cst-filter-select,
    .cst-search-input {
        min-width: auto;
        max-width: none;
    }
    
    .cst-profile-actions {
        flex-direction: column;
    }
    
    .cst-messages {
        left: 10px;
        right: 10px;
        max-width: none;
    }
    
    .cst-form-actions {
        flex-direction: column;
    }
    
    .cst-btn {
        width: 100%;
        justify-content: center;
    }
    
    .cst-admin-restricted {
        margin: 20px;
        padding: 30px 20px;
    }
}


@media (max-width: 480px) {
    .cst-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .cst-stat-number {
        font-size: 28px;
    }
    
    .cst-ticket-preview-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .cst-ticket-preview-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .cst-panel-header {
        padding: 20px 15px;
    }
    
    .cst-original-message,
    .cst-reply-form-section {
        padding: 20px 15px;
    }
    
    .cst-admin-restricted {
        margin: 10px;
        padding: 25px 15px;
    }
    
    .cst-admin-restricted h3 {
        font-size: 20px;
    }
}
