/**
 * Modern UI Components - Material Design 3.0 Extension
 * Additional components and improvements for the frontend
 */

/* Enhanced Card System */
.uecrm-card {
    background: var(--md-surface);
    color: var(--md-on-surface);
    border-radius: 12px;
    box-shadow: var(--md-elevation-1);
    border: 1px solid var(--md-outline-variant);
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.uecrm-card.elevated {
    box-shadow: var(--md-elevation-2);
    border: none;
}

.uecrm-card.outlined {
    border: 2px solid var(--md-outline);
    box-shadow: none;
}

.uecrm-card:hover {
    box-shadow: var(--md-elevation-3);
    transform: translateY(-1px);
}

.uecrm-card-header {
    padding: 16px 16px 0 16px;
}

.uecrm-card-content {
    padding: 16px;
}

.uecrm-card-actions {
    padding: 8px 16px 16px 16px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.uecrm-card-actions.justified {
    justify-content: space-between;
}

/* Chip Component */
.uecrm-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 8px;
    font: var(--md-label-medium);
    background: var(--md-surface-variant);
    color: var(--md-on-surface-variant);
    border: 1px solid var(--md-outline);
    transition: all 0.2s ease;
    cursor: default;
    gap: 4px;
}

.uecrm-chip.primary {
    background: var(--md-primary-container);
    color: var(--md-on-primary-container);
    border-color: var(--md-primary);
}

.uecrm-chip.secondary {
    background: var(--md-secondary-container);
    color: var(--md-on-secondary-container);
    border-color: var(--md-secondary);
}

.uecrm-chip.success {
    background: rgba(46, 125, 50, 0.1);
    color: #1b5e20;
    border-color: #4caf50;
}

.uecrm-chip.warning {
    background: rgba(239, 108, 0, 0.1);
    color: #e65100;
    border-color: #ff9800;
}

.uecrm-chip.error {
    background: var(--md-error-container);
    color: var(--md-on-error-container);
    border-color: var(--md-error);
}

.uecrm-chip i {
    font-size: 16px;
}

/* Badge Component */
.uecrm-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    font: var(--md-label-small);
    background: var(--md-error);
    color: var(--md-on-error);
    border-radius: 10px;
    position: absolute;
    top: -8px;
    right: -8px;
}

.uecrm-badge.primary {
    background: var(--md-primary);
    color: var(--md-on-primary);
}

.uecrm-badge.secondary {
    background: var(--md-secondary);
    color: var(--md-on-secondary);
}

/* Avatar Component */
.uecrm-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--md-primary-container);
    color: var(--md-on-primary-container);
    font: var(--md-title-medium);
    overflow: hidden;
    position: relative;
}

.uecrm-avatar.large {
    width: 56px;
    height: 56px;
    font: var(--md-headline-small);
}

.uecrm-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Progress Indicators */
.uecrm-progress-linear {
    width: 100%;
    height: 4px;
    background: var(--md-surface-variant);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.uecrm-progress-linear .progress-bar {
    height: 100%;
    background: var(--md-primary);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.uecrm-progress-linear.indeterminate .progress-bar {
    width: 30%;
    animation: progress-indeterminate 2s infinite linear;
}

@keyframes progress-indeterminate {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(400%);
    }
}

/* Snackbar Component */
.uecrm-snackbar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--md-inverse-surface);
    color: var(--md-inverse-on-surface);
    padding: 14px 16px;
    border-radius: 4px;
    font: var(--md-body-medium);
    box-shadow: var(--md-elevation-3);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 344px;
    min-width: 288px;
    animation: snackbar-enter 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.uecrm-snackbar.success {
    background: #2e7d32;
    color: white;
}

.uecrm-snackbar.error {
    background: var(--md-error);
    color: var(--md-on-error);
}

.uecrm-snackbar.warning {
    background: #ef6c00;
    color: white;
}

.uecrm-snackbar-action {
    background: transparent;
    border: none;
    color: var(--md-inverse-primary);
    font: var(--md-label-large);
    padding: 8px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.uecrm-snackbar-action:hover {
    background: rgba(255, 255, 255, 0.1);
}

@keyframes snackbar-enter {
    from {
        transform: translateX(-50%) translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* Icon Button */
.uecrm-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--md-on-surface);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.uecrm-icon-btn:hover {
    background: var(--md-on-surface);
    background: color-mix(in srgb, var(--md-on-surface) 8%, transparent);
}

.uecrm-icon-btn:focus {
    outline: none;
    background: color-mix(in srgb, var(--md-on-surface) 12%, transparent);
}

.uecrm-icon-btn:active {
    background: color-mix(in srgb, var(--md-on-surface) 16%, transparent);
}

.uecrm-icon-btn i {
    font-size: 24px;
}

/* Switch Component */
.uecrm-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 32px;
}

.uecrm-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.uecrm-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--md-outline);
    border-radius: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.uecrm-switch .slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 6px;
    top: 6px;
    background: var(--md-outline);
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.uecrm-switch input:checked + .slider {
    background: var(--md-primary);
}

.uecrm-switch input:checked + .slider:before {
    transform: translateX(20px);
    background: var(--md-on-primary);
}

/* Tooltip */
.uecrm-tooltip {
    position: relative;
    cursor: pointer;
}

.uecrm-tooltip .tooltip-content {
    visibility: hidden;
    background: var(--md-inverse-surface);
    color: var(--md-inverse-on-surface);
    text-align: center;
    border-radius: 4px;
    padding: 8px 12px;
    position: absolute;
    z-index: 1001;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: all 0.2s ease;
    font: var(--md-body-small);
    white-space: nowrap;
    box-shadow: var(--md-elevation-2);
}

.uecrm-tooltip .tooltip-content::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--md-inverse-surface) transparent transparent transparent;
}

.uecrm-tooltip:hover .tooltip-content {
    visibility: visible;
    opacity: 1;
}

/* Responsive Design Enhancements */
@media (max-width: 768px) {
    .uecrm-snackbar {
        left: 16px;
        right: 16px;
        transform: none;
        max-width: none;
        min-width: auto;
    }
    
    .uecrm-card {
        margin: 0 8px;
    }
    
    .uecrm-chip {
        font-size: 11px;
        padding: 4px 8px;
    }
}

/* Google Material Design Inspired Ticket Cards */
.material-ticket-card {
    position: relative;
    display: block;
    background: var(--md-surface);
    border: 1px solid var(--md-outline-variant);
    border-radius: 16px;
    padding: 0;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    overflow: hidden;
    box-shadow: var(--md-elevation-1);
    transform: translateY(0);
    text-decoration: none;
    color: inherit;
}

.material-ticket-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--md-elevation-3);
    border-color: var(--md-outline);
    text-decoration: none;
    color: inherit;
}

.material-ticket-card.selected {
    border-color: var(--md-primary);
    background: var(--md-primary-container);
    transform: translateY(-2px);
    box-shadow: var(--md-elevation-2);
}

.material-ticket-card.popular {
    border-color: var(--md-primary);
    position: relative;
}

.material-ticket-card.popular::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--md-primary), var(--md-tertiary));
}

.popular-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--md-primary);
    color: var(--md-on-primary);
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 2;
    box-shadow: var(--md-elevation-2);
}

.popular-badge i {
    font-size: 14px;
}

.material-ticket-card input[type="radio"] {
    display: none;
}

.ticket-visual {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px;
    background: linear-gradient(135deg, var(--md-surface-variant), var(--md-primary-container));
}

.ticket-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--md-elevation-2);
}

.ticket-icon i {
    font-size: 24px;
    color: white;
}

.ticket-price-display {
    display: flex;
    align-items: baseline;
    gap: 2px;
    color: var(--md-primary);
}

.price-currency {
    font-size: 14px;
    font-weight: 500;
    opacity: 0.8;
}

.price-amount {
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
}

.price-decimal {
    font-size: 18px;
    font-weight: 500;
    opacity: 0.8;
}

.ticket-content {
    padding: 24px;
}

.ticket-name {
    margin: 0 0 8px 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--md-on-surface);
}

.ticket-description {
    margin: 0 0 20px 0;
    color: var(--md-on-surface-variant);
    font-size: 14px;
    line-height: 1.5;
}

.ticket-features {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--md-on-surface-variant);
    font-size: 14px;
}

.feature-item i {
    font-size: 18px;
    color: var(--md-primary);
    width: 18px;
}

.ticket-select-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--md-surface-variant);
    border-radius: 12px;
    color: var(--md-on-surface-variant);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.material-ticket-card.selected .ticket-select-indicator {
    background: var(--md-primary);
    color: var(--md-on-primary);
}

.ticket-select-indicator i {
    font-size: 20px;
}

.ticket-ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(103, 80, 164, 0.2);
    transform: scale(0);
    pointer-events: none;
}

.ticket-ripple.ripple-active {
    animation: ripple-effect 0.6s ease-out;
}

@keyframes ripple-effect {
    to {
        transform: scale(2);
        opacity: 0;
    }
}

/* Ticket Grid Layout */
.tickets-selection {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

/* Mobile Responsive Design for Tickets */
@media (max-width: 768px) {
    .tickets-selection {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .material-ticket-card {
        border-radius: 12px;
    }
    
    .ticket-visual {
        padding: 20px;
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
    
    .ticket-price-display {
        order: -1;
    }
    
    .ticket-content {
        padding: 20px;
    }
    
    .ticket-features {
        gap: 10px;
    }
    
    .popular-badge {
        position: static;
        margin-bottom: 12px;
        align-self: flex-start;
    }
}

@media (max-width: 480px) {
    .material-ticket-card {
        margin: 0 -4px;
    }
    
    .ticket-visual {
        padding: 16px;
    }
    
    .ticket-content {
        padding: 16px;
    }
    
    .price-amount {
        font-size: 28px;
    }
    
    .ticket-name {
        font-size: 18px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --md-primary: #d0bcff;
        --md-on-primary: #371e73;
        --md-primary-container: #4f378b;
        --md-on-primary-container: #eaddff;
        --md-secondary: #ccc2dc;
        --md-on-secondary: #332d41;
        --md-secondary-container: #4a4458;
        --md-on-secondary-container: #e8def8;
        --md-background: #1c1b1f;
        --md-on-background: #e6e1e5;
        --md-surface: #1c1b1f;
        --md-on-surface: #e6e1e5;
        --md-surface-variant: #49454f;
        --md-on-surface-variant: #cac4d0;
        --md-outline: #938f99;
        --md-outline-variant: #49454f;
    }
}