:root {
    --primary-color: #2563eb;
    --success-color: #22c55e;
    --error-color: #ef4444;
    --background-color: #f8fafc;
    --card-background: #ffffff;
    --text-color: #1e293b;
    --border-color: #e2e8f0;
    --header-height: 32px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: transparent;
    color: var(--text-color);
    line-height: 1.5;
    display: flex;
    flex-direction: column;
}

.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background-color: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    z-index: 100;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.auth-button {
    display: none; /* Hide auth button */
}

.history-button {
    margin-left: auto;
    padding: 0.375rem 1rem;
    font-size: 0.875rem;
    background-color: rgba(255, 255, 255, 0.2) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    color: white;
    transition: all 0.2s;
    height: calc(var(--header-height) - 0.5rem);
    display: flex;
    align-items: center;
}

.history-button:hover {
    background-color: rgba(255, 255, 255, 0.3) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: calc(var(--header-height) + 1.5rem) 1rem 1rem;
    min-height: 100vh;
    position: relative;
    overflow: visible;
}

.input-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    position: relative;
}

input {
    width: 100%;
    padding: 0.875rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 0.75rem;
    font-size: 1.25rem;
    text-align: center;
    text-transform: uppercase;
    transition: all 0.2s;
    background-color: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

input:focus {
    outline: none;
    border-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
    background-color: rgba(255, 255, 255, 0.2);
}

/* Placeholder styling */
input::placeholder {
    color: rgba(255, 255, 255, 0.8);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

input::-webkit-input-placeholder {
    color: rgba(255, 255, 255, 0.8);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

input::-moz-placeholder {
    color: rgba(255, 255, 255, 0.8);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

input:-ms-input-placeholder {
    color: rgba(255, 255, 255, 0.8);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.validate-button {
    width: 100%;
    padding: 0.875rem;
    font-size: 1.25rem;
    border-radius: 0.75rem;
    margin-top: 0.5rem;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
}

.button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.button:hover {
    background-color: #1d4ed8;
}

.button:disabled {
    background-color: #94a3b8;
    cursor: not-allowed;
}

.status-indicator {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    background-color: var(--error-color);
    transition: background-color 0.3s ease;
}

.status-indicator.success {
    background-color: var(--success-color);
}

.status-indicator.loading {
    background-color: var(--primary-color);
    animation: pulse 1.5s infinite;
}

.spinner {
    width: 2.5rem;
    height: 2.5rem;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 1rem auto;
}

.result-section {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background-color: var(--card-background);
    box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.1);
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.result-section.visible {
    transform: translateY(0);
}

.hidden {
    display: none;
}

.error-message {
    color: var(--error-color);
    font-size: 0.875rem;
    text-align: center;
    min-height: 1.25rem;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

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

/* Toast Notification */
.toast-container {
    position: fixed;
    top: calc(var(--header-height) + 0.5rem);
    left: 1rem;
    right: 1rem;
    z-index: 1000;
}

.toast {
    background-color: var(--card-background);
    color: var(--text-color);
    padding: 0.75rem;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: slideIn 0.3s ease-out;
}

.toast.error {
    border-left: 4px solid var(--error-color);
}

.toast.success {
    border-left: 4px solid var(--success-color);
}

.toast.warning {
    border-left: 4px solid #f59e0b;
}

.toast-message {
    flex-grow: 1;
    font-size: 0.875rem;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-color);
    opacity: 0.5;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.toast-close:hover {
    opacity: 1;
}

@keyframes slideIn {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(-100%);
        opacity: 0;
    }
}

.toast.hiding {
    animation: slideOut 0.3s ease-in forwards;
}

.status-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-message {
    font-size: 0.875rem;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.status-message.visible {
    opacity: 1;
}

/* History Page Styles */
.history-page {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 200;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.history-page.hidden {
    display: none;
}

.history-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background-color: rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    flex-wrap: nowrap;
    min-height: 60px;
}

.history-header h1 {
    color: white;
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
    flex-shrink: 0;
}

.history-search {
    margin-left: auto;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    background-color: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 0.5rem;
    color: white;
    transition: all 0.2s;
    min-width: 250px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.history-search::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.history-search:focus {
    outline: none;
    background-color: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
}

.back-button {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    background-color: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    transition: all 0.2s;
    flex-shrink: 0;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-button:hover {
    background-color: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.history-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.history-loading {
    text-align: center;
    color: white;
    font-size: 1rem;
    padding: 2rem;
    opacity: 0.8;
}

.history-item {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.75rem;
    padding: 0.75rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.2s;
    animation: fadeInUp 0.3s ease-out;
    position: relative;
}

.history-item:hover {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.375rem;
}

.history-ticket {
    font-size: 1.125rem;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.history-status {
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-status.confirmed {
    background-color: rgba(34, 197, 94, 0.2);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.history-status.rejected {
    background-color: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.history-status-container {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    align-items: flex-end;
}

.history-details {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.history-date {
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.8);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.history-time-ago {
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
}

.history-info-chip {
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background-color: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.history-end-message {
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.875rem;
    padding: 2rem;
    font-style: italic;
}

.load-more-button {
    width: 100%;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    background-color: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 0.5rem;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 1rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.load-more-button:hover {
    background-color: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

.load-more-button:active {
    transform: translateY(0);
}
