/**
 * Ticket Manager Frontend Styles
 * 
 * Styles for user dashboard, ticket display, and frontend components
 *
 * @package TicketManager
 * @version 1.0.0
 */

/* ==========================================================================
   User Dashboard Styles
   ========================================================================== */

.tm-user-dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.tm-dashboard-header {
    text-align: center;
    margin-bottom: 30px;
}

.tm-dashboard-header h2 {
    margin: 0 0 10px;
    font-size: 28px;
    font-weight: 600;
    color: #1a1a1a;
}

.tm-dashboard-subtitle {
    margin: 0;
    font-size: 16px;
    color: #666;
}

/* Dashboard Statistics */
.tm-dashboard-stats {
    margin-bottom: 40px;
}

.tm-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.tm-stat-card {
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tm-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.tm-stat-icon {
    margin-bottom: 10px;
}

.tm-stat-icon .dashicons {
    font-size: 32px;
    width: 32px;
    height: 32px;
    color: #0073aa;
}

.tm-stat-icon.validated .dashicons {
    color: #46b450;
}

.tm-stat-icon.active .dashicons {
    color: #00a0d2;
}

.tm-stat-icon.pending .dashicons {
    color: #ffb900;
}

.tm-stat-number {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 5px;
}

.tm-stat-label {
    font-size: 14px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Recent Orders Section */
.tm-recent-orders {
    margin-bottom: 40px;
}

.tm-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e1e1e1;
}

.tm-section-header h3 {
    margin: 0;
    font-size: 22px;
    color: #1a1a1a;
}

.tm-view-all {
    color: #0073aa;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.tm-view-all:hover {
    color: #005177;
}

/* Order Cards */
.tm-orders-list {
    display: grid;
    gap: 20px;
}

.tm-order-card {
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tm-order-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.tm-order-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.tm-order-title {
    margin: 0 0 5px;
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
}

.tm-order-date {
    font-size: 14px;
    color: #666;
}

.tm-status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tm-status-active {
    background: #d4edda;
    color: #155724;
}

.tm-status-pending {
    background: #fff3cd;
    color: #856404;
}

.tm-status-expired {
    background: #f8d7da;
    color: #721c24;
}

.tm-status-cancelled {
    background: #f8d7da;
    color: #721c24;
}

.tm-status-refunded {
    background: #d1ecf1;
    color: #0c5460;
}

/* Order Details */
.tm-order-details {
    margin-bottom: 20px;
}

.tm-ticket-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.tm-ticket-count {
    display: flex;
    align-items: center;
    font-weight: 500;
}

.tm-ticket-icon {
    margin-right: 8px;
    font-size: 16px;
}

.tm-validation-status {
    text-align: right;
}

.tm-validation-count {
    display: block;
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.tm-progress-bar {
    width: 100px;
    height: 4px;
    background: #e1e1e1;
    border-radius: 2px;
    overflow: hidden;
}

.tm-progress-fill {
    height: 100%;
    background: #46b450;
    border-radius: 2px;
    transition: width 0.3s ease;
}

.tm-event-info {
    display: flex;
    align-items: center;
    font-size: 14px;
    color: #666;
}

.tm-event-icon {
    margin-right: 8px;
}

/* Order Actions */
.tm-order-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tm-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 1.4;
}

.tm-btn-primary {
    background: #0073aa;
    color: #fff;
}

.tm-btn-primary:hover {
    background: #005177;
    color: #fff;
}

.tm-btn-secondary {
    background: #666;
    color: #fff;
}

.tm-btn-secondary:hover {
    background: #444;
    color: #fff;
}

.tm-btn-outline {
    background: transparent;
    color: #0073aa;
    border: 1px solid #0073aa;
}

.tm-btn-outline:hover {
    background: #0073aa;
    color: #fff;
}

/* Load More */
.tm-load-more-container {
    text-align: center;
    margin-top: 30px;
}

.tm-load-more {
    min-width: 150px;
}

/* No Orders State */
.tm-no-orders {
    text-align: center;
    padding: 60px 20px;
}

.tm-no-orders-icon .dashicons {
    font-size: 64px;
    color: #ccc;
    margin-bottom: 20px;
}

.tm-no-orders h3 {
    margin: 0 0 10px;
    color: #666;
}

.tm-no-orders p {
    margin: 0;
    color: #999;
}

/* ==========================================================================
   Modal Styles
   ========================================================================== */

.tm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tm-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    cursor: pointer;
}

.tm-modal-content {
    position: relative;
    background: #fff;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.tm-modal-large {
    max-width: 800px;
}

.tm-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e1e1e1;
}

.tm-modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.tm-modal-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #666;
    padding: 5px;
}

.tm-modal-close:hover {
    color: #000;
}

.tm-modal-body {
    padding: 20px;
    max-height: calc(90vh - 80px);
    overflow-y: auto;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .tm-user-dashboard {
        padding: 15px;
    }

    .tm-dashboard-header h2 {
        font-size: 24px;
    }

    .tm-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .tm-stat-card {
        padding: 15px;
    }

    .tm-order-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .tm-ticket-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .tm-validation-status {
        text-align: left;
    }

    .tm-order-actions {
        flex-direction: column;
    }

    .tm-btn {
        width: 100%;
    }

    .tm-modal-content {
        width: 95%;
    }
}

@media (max-width: 480px) {
    .tm-stats-grid {
        grid-template-columns: 1fr;
    }

    .tm-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.tm-loading {
    opacity: 0.6;
    pointer-events: none;
}

.tm-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: tm-spin 1s linear infinite;
}

@keyframes tm-spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.tm-btn:focus,
.tm-view-all:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.tm-modal-close:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Screen reader only text */
.tm-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {

    .tm-stat-card,
    .tm-order-card {
        border-width: 2px;
    }

    .tm-btn {
        border-width: 2px;
    }
}