/**
 * EventHex My Tickets Widget Styles - Matching Next.js Design
 * Based on Shadcn UI / Tailwind CSS design patterns
 */

/* === Base Container === */
.eventhex-my-tickets-widget {
    width: 100%;
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.5;
}

.eventhex-my-tickets-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Wider container when displaying tickets */
.eventhex-my-tickets-widget:has(.eventhex-step-tickets.active) .eventhex-my-tickets-container {
    max-width: 1200px;
}

/* Alternative for browsers that don't support :has() */
.eventhex-step-tickets.active ~ * .eventhex-my-tickets-container,
.eventhex-my-tickets-container.showing-tickets {
    max-width: 1200px;
}

/* === Card Container === */
.eventhex-my-tickets-form {
    position: relative;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 12px;
    border: none;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    overflow: visible;
}

/* === Header with Icon === */
.eventhex-my-tickets-header {
    text-align: center;
    padding: 24px 16px 20px;
    border-bottom: 1px solid rgba(229, 231, 235, 1);
    margin-bottom: 24px;
}

.eventhex-my-tickets-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background-color: var(--e-primary-color, #2563eb);
    border-radius: 50%;
    margin: 0 auto 12px;
}

.eventhex-my-tickets-icon svg {
    width: 24px;
    height: 24px;
    color: #ffffff;
}

.eventhex-my-tickets-title {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 8px;
    line-height: 1.2;
}

.eventhex-my-tickets-subtitle {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
    line-height: 1.5;
}

/* === Step Container === */
.eventhex-step {
    display: none;
    padding: 24px;
}

.eventhex-step.active {
    display: block;
}

/* === Form Groups === */
.eventhex-form-group {
    margin-bottom: 28px;
}

.eventhex-form-group label,
.eventhex-form-label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 10px;
}

/* === Phone Input === */
.eventhex-phone-input-wrapper {
    display: flex;
    align-items: stretch;
    gap: 12px;
    flex-wrap: nowrap;
}

/* Custom Country Dropdown */
.eventhex-country-select-wrapper {
    position: relative;
    width: auto;
    min-width: 120px;
    flex-shrink: 0;
    z-index: 100;
}

.eventhex-country-select-button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 12px;
    border: 1px solid #e5e7eb !important;
    border-radius: 8px;
    font-size: 14px;
    color: #111827;
    background: #ffffff !important;
    cursor: pointer;
    transition: all 0.2s;
    outline: none !important;
    box-shadow: none !important;
}

.eventhex-country-select-button:hover {
    border-color: #d1d5db !important;
    background: #ffffff !important;
}

.eventhex-country-select-button:focus {
    outline: none !important;
    border-color: #d1d5db !important;
    box-shadow: none !important;
    background: #ffffff !important;
}

.eventhex-country-select-button:active {
    background: #ffffff !important;
}

.eventhex-country-select-button .selected-country-display {
    display: flex;
    align-items: center;
    gap: 6px;
}

.eventhex-country-select-button .selected-country-flag {
    font-size: 16px;
    line-height: 1;
    display: inline-block;
}

.eventhex-country-select-button .selected-country-code {
    font-weight: 500;
    color: #111827;
    font-size: 14px;
}

.eventhex-country-select-button .dropdown-arrow {
    width: 16px;
    height: 16px;
    color: #6b7280;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.eventhex-country-select-button.active .dropdown-arrow {
    transform: rotate(180deg);
}

/* Dropdown Panel */
.eventhex-country-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 280px;
    min-width: 100%;
    margin-top: 4px;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    z-index: 9999;
    display: none;
    max-height: 360px;
    overflow: hidden;
}

.eventhex-country-dropdown.active {
    display: block;
}

/* Search Input */
.eventhex-country-dropdown .country-search-wrapper {
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    background: #ffffff;
    z-index: 1;
}

.eventhex-country-dropdown .search-input-wrapper {
    position: relative;
}

.eventhex-country-dropdown .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: #9ca3af;
    pointer-events: none;
}

.eventhex-country-dropdown .country-search-input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    color: #111827;
    background: #ffffff;
    transition: all 0.2s;
}

.eventhex-country-dropdown .country-search-input:hover {
    border-color: #9ca3af;
}

.eventhex-country-dropdown .country-search-input:focus {
    outline: none;
    border-color: var(--e-primary-color, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.eventhex-country-dropdown .country-search-input::placeholder {
    color: #c0c0c0;
    font-weight: 400;
    opacity: 1;
}

/* Country List */
.eventhex-country-dropdown .country-list-wrapper {
    max-height: 288px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Continent Group */
.eventhex-country-dropdown .continent-group {
    margin-bottom: 4px;
}

.eventhex-country-dropdown .continent-header {
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #f9fafb;
    position: sticky;
    top: 0;
    z-index: 1;
}

/* Country Item */
.eventhex-country-dropdown .country-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: background-color 0.15s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.eventhex-country-dropdown .country-item:hover {
    background-color: #f3f4f6;
}

.eventhex-country-dropdown .country-item.selected {
    background-color: #eff6ff;
    color: var(--e-primary-color, #2563eb);
}

.eventhex-country-dropdown .country-item .country-flag {
    font-size: 20px;
    line-height: 1;
    margin-right: 12px;
    min-width: 24px;
}

.eventhex-country-dropdown .country-item .country-details {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.eventhex-country-dropdown .country-item .country-name {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
}

.eventhex-country-dropdown .country-item .country-code {
    font-size: 13px;
    color: #6b7280;
}

.eventhex-country-dropdown .country-item.no-results {
    color: #6b7280;
    text-align: center;
    padding: 24px 16px;
    cursor: default;
}

.eventhex-country-dropdown .country-item.no-results:hover {
    background-color: transparent;
}

/* Scrollbar Styling */
.eventhex-country-dropdown .country-list-wrapper::-webkit-scrollbar {
    width: 8px;
}

.eventhex-country-dropdown .country-list-wrapper::-webkit-scrollbar-track {
    background: #f9fafb;
    border-radius: 4px;
}

.eventhex-country-dropdown .country-list-wrapper::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

.eventhex-country-dropdown .country-list-wrapper::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Old select - hide when custom dropdown is active */
.eventhex-country-code {
    width: 45%;
    padding: 14px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    color: #111827;
    background: #ffffff;
    transition: all 0.2s;
    cursor: pointer;
}

.eventhex-country-code:focus {
    outline: none;
    border-color: var(--e-primary-color, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.eventhex-mobile-input {
    flex: 1 1 auto;
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #e5e7eb !important;
    border-radius: 8px;
    font-size: 14px;
    color: #111827;
    background: #ffffff !important;
    transition: all 0.2s;
    outline: none !important;
    box-shadow: none !important;
}

.eventhex-mobile-input::placeholder {
    color: #c0c0c0;
    font-weight: 400;
    opacity: 1;
}

.eventhex-mobile-input:hover {
    border-color: #d1d5db !important;
}

.eventhex-mobile-input:focus {
    outline: none !important;
    border-color: #d1d5db !important;
    box-shadow: none !important;
}

/* === OTP Section === */
.eventhex-otp-info {
    text-align: center;
    margin-bottom: 24px;
}

.eventhex-otp-info p {
    margin: 4px 0;
    color: #6b7280;
    font-size: 14px;
}

.eventhex-otp-info .mobile-display {
    color: #111827;
    font-weight: 600;
}

.eventhex-change-mobile {
    background: none;
    border: none;
    color: var(--e-primary-color, #2563eb);
    font-size: 14px;
    cursor: pointer;
    text-decoration: underline;
    margin-top: 8px;
    padding: 0;
    transition: color 0.2s;
}

.eventhex-change-mobile:hover {
    color: #1d4ed8;
}

.eventhex-otp-inputs {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin: 20px 0 24px;
}

.eventhex-otp-input {
    width: 56px;
    height: 56px;
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    color: #111827;
    background: #ffffff;
    transition: all 0.2s;
}

.eventhex-otp-input:hover {
    border-color: #d1d5db;
}

.eventhex-otp-input:focus {
    outline: none;
    border-color: #d1d5db;
    box-shadow: none;
}

.eventhex-otp-input:not(:placeholder-shown) {
    border-color: #d1d5db;
}

.eventhex-otp-helper-text {
    text-align: center;
    font-size: 14px;
    color: #6b7280;
    margin: 16px 0 24px;
}

.eventhex-change-mobile-wrapper {
    text-align: center;
    margin-bottom: 20px;
}

.eventhex-change-mobile-wrapper .eventhex-change-mobile {
    background: none;
    border: none;
    color: #111827;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    transition: opacity 0.2s;
}

.eventhex-change-mobile-wrapper .eventhex-change-mobile:hover {
    opacity: 0.7;
}

.eventhex-change-mobile-wrapper .eventhex-change-mobile svg {
    flex-shrink: 0;
}

.eventhex-resend-wrapper {
    text-align: center;
    margin: 16px 0 24px;
}

.eventhex-timer {
    color: #6b7280;
    font-size: 14px;
    margin: 0 0 8px;
}

.eventhex-resend-otp {
    background: none;
    border: none;
    color: var(--e-primary-color, #2563eb);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 0;
    transition: color 0.2s;
}

.eventhex-resend-otp:hover {
    color: #1d4ed8;
}

/* === Buttons === */
.eventhex-my-tickets-button {
    width: 100%;
    padding: 14px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.eventhex-my-tickets-button:not(:disabled) {
    background-color: var(--e-primary-color, #2563eb);
    color: #ffffff;
}

.eventhex-my-tickets-button:not(:disabled):hover {
    background-color: var(--e-primary-color, #1d4ed8);
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.eventhex-my-tickets-button:disabled {
    background-color: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
}

.eventhex-my-tickets-button .button-loader {
    display: none;
}

.eventhex-my-tickets-button.loading .button-text {
    display: none;
}

.eventhex-my-tickets-button.loading .button-loader {
    display: flex;
    align-items: center;
    gap: 8px;
}

.eventhex-my-tickets-button .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* === Error Messages === */
.eventhex-form-error {
    display: none;
    padding: 12px 16px;
    background-color: #fef2f2;
    border: 1px solid: #fecaca;
    border-radius: 8px;
    color: #dc2626;
    font-size: 14px;
    margin-top: 12px;
}

.eventhex-form-error.show {
    display: block;
}

/* === Tickets Display === */
.eventhex-tickets-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.eventhex-tickets-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.eventhex-logout-btn {
    background: none;
    border: none;
    color: var(--e-primary-color, #2563eb);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    transition: all 0.2s;
}

.eventhex-logout-btn:hover {
    color: #1d4ed8;
    background-color: rgba(37, 99, 235, 0.1);
    border-radius: 6px;
}

.eventhex-tickets-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(480px, 1fr));
    gap: 24px;
}

/* Single column on smaller screens */
@media (max-width: 1024px) {
    .eventhex-tickets-list {
        grid-template-columns: 1fr;
    }
}

/* === Ticket Card === */
.eventhex-ticket-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transition: box-shadow 0.3s;
    height: fit-content;
}

.eventhex-ticket-card:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.eventhex-ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px 20px 16px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 16px;
}

.eventhex-ticket-title-section {
    flex: 1;
}

.eventhex-ticket-title {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 4px;
}

.eventhex-ticket-description {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 8px;
}

.eventhex-ticket-number {
    font-size: 12px;
    color: var(--e-primary-color, #2563eb);
    font-weight: 500;
    margin: 0;
}

.eventhex-ticket-badges {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

.eventhex-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid;
}

.eventhex-badge.attended {
    background-color: #dcfce7;
    color: #166534;
    border-color: #bbf7d0;
}

.eventhex-badge.not-attended {
    background-color: #f3f4f6;
    color: #374151;
    border-color: #e5e7eb;
}

.eventhex-badge.approved {
    background-color: #dcfce7;
    color: #166534;
    border-color: #bbf7d0;
}

.eventhex-badge.pending {
    background-color: #fef3c7;
    color: #92400e;
    border-color: #fde68a;
}

.eventhex-badge.rejected {
    background-color: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}

.eventhex-ticket-body {
    padding: 0 20px 20px;
}

.eventhex-ticket-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.eventhex-ticket-info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #6b7280;
}

.eventhex-ticket-info-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.eventhex-qr-code {
    text-align: center;
    margin: 16px 0;
}

.eventhex-qr-code img {
    max-width: 200px;
    height: auto;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 8px;
    background: #fff;
}

.eventhex-ticket-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 16px;
}

.eventhex-ticket-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid;
}

.eventhex-ticket-btn.view {
    background-color: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

.eventhex-ticket-btn.view:hover {
    background-color: #1d4ed8;
    border-color: #1d4ed8;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.eventhex-ticket-btn.download {
    background-color: #ffffff;
    border-color: #2563eb;
    color: #2563eb;
}

.eventhex-ticket-btn.download:hover {
    background-color: #2563eb;
    color: #ffffff;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.eventhex-ticket-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.eventhex-ticket-btn svg {
    width: 16px;
    height: 16px;
}

.eventhex-no-tickets {
    text-align: center;
    padding: 60px 20px;
}

.eventhex-no-tickets svg {
    width: 64px;
    height: 64px;
    color: #9ca3af;
    margin: 0 auto 16px;
}

.eventhex-no-tickets h3 {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 8px;
}

.eventhex-no-tickets p {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 24px;
}

/* === Responsive === */
@media (max-width: 768px) {
    .eventhex-my-tickets-container {
        padding: 0 12px;
        max-width: 100%;
    }

    .eventhex-my-tickets-header {
        padding: 16px 12px 12px;
        margin-bottom: 12px;
    }

    .eventhex-my-tickets-icon {
        width: 40px;
        height: 40px;
        margin-bottom: 10px;
    }

    .eventhex-my-tickets-icon svg {
        width: 20px;
        height: 20px;
    }

    .eventhex-step {
        padding: 16px 12px;
    }

    .eventhex-my-tickets-title {
        font-size: 20px;
    }

    .eventhex-my-tickets-subtitle {
        font-size: 13px;
    }

    .eventhex-phone-input-wrapper {
        flex-direction: row;
        gap: 8px;
        flex-wrap: nowrap;
    }

    .eventhex-country-select-wrapper {
        width: auto;
        max-width: none;
        min-width: 90px;
        flex-shrink: 0;
    }

    .eventhex-country-select-button {
        padding: 12px 8px;
    }

    .eventhex-country-select-button .selected-country-code {
        font-size: 13px;
    }

    .eventhex-country-code {
        width: auto;
        min-width: 90px;
    }

    .eventhex-phone-input,
    .eventhex-mobile-input {
        width: 100%;
        flex: 1;
        padding: 12px 12px;
        font-size: 14px;
    }

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

    .eventhex-otp-inputs {
        gap: 6px;
    }

    .eventhex-otp-input {
        width: 40px;
        height: 48px;
        font-size: 18px;
    }

    .eventhex-ticket-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .eventhex-ticket-badges {
        align-items: flex-start;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .eventhex-ticket-actions {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .eventhex-ticket-body {
        padding: 16px;
    }

    .eventhex-ticket-details {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .eventhex-btn {
        padding: 12px 20px;
        font-size: 15px;
    }

    .eventhex-btn-secondary {
        padding: 10px 18px;
        font-size: 14px;
    }

    .eventhex-tickets-list {
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .eventhex-my-tickets-container {
        padding: 0 10px;
    }

    .eventhex-my-tickets-header {
        padding: 12px 10px 10px;
    }

    .eventhex-step {
        padding: 12px 10px;
    }

    .eventhex-my-tickets-title {
        font-size: 18px;
    }

    .eventhex-otp-inputs {
        gap: 4px;
    }

    .eventhex-otp-input {
        width: 36px;
        height: 44px;
        font-size: 16px;
    }

    .eventhex-ticket-card {
        border-radius: 8px;
    }

    .eventhex-ticket-header {
        padding: 12px;
    }

    .eventhex-ticket-body {
        padding: 12px;
    }

    .eventhex-detail-item {
        padding: 10px;
    }

    .eventhex-btn {
        padding: 10px 16px;
        font-size: 14px;
    }

    .eventhex-back-button {
        padding: 8px 14px;
        font-size: 13px;
    }
}

/* === Additional Info Text === */
.eventhex-info-text {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #f3f4f6;
}

.eventhex-info-text p {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
    line-height: 1.6;
}
