@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --surface2: #232734;
    --border: #2d3244;
    --accent: #6c5ce7;
    --accent2: #a29bfe;
    --green: #00b894;
    --yellow: #fdcb6e;
    --red: #e17055;
    --cyan: #81ecec;
    --text: #dfe6e9;
    --text2: #a0a8b4;
    --text3: #636e7b;
    --radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    padding: 30px 0 20px;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent2), var(--cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text2);
    margin-top: 6px;
    font-size: 0.95rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}

.card h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--accent2);
}

.input-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 700px) {
    .input-section {
        grid-template-columns: 1fr;
    }

    header h1 {
        font-size: 1.4rem;
    }
}

/* QR Scanner */
.video-wrapper {
    position: relative;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 12px;
    background: var(--surface2);
    min-height: 50px;
}

#qr-video {
    width: 100%;
    display: block;
    border-radius: 8px;
}

.scanner-controls {
    display: flex;
    gap: 8px;
}

.upload-section {
    margin-top: 10px;
}

.upload-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text2);
    margin-bottom: 6px;
    cursor: pointer;
}

.upload-label:hover {
    color: var(--accent2);
}

#qr-file-input {
    font-size: 0.85rem;
    color: var(--text2);
}

.scan-status {
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--green);
}

/* Buttons */
button {
    background: linear-gradient(135deg, var(--accent), #5a4bd1);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.4);
}

button:active {
    transform: translateY(0);
}

/* Hex input */
textarea {
    width: 100%;
    min-height: 100px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 12px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    resize: vertical;
    margin-bottom: 12px;
}

textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.2);
}

textarea::placeholder {
    color: var(--text3);
}

/* Error */
.error-message {
    background: rgba(225, 112, 85, 0.15);
    border: 1px solid var(--red);
    border-radius: var(--radius);
    padding: 14px 18px;
    margin-bottom: 16px;
    color: var(--red);
    font-size: 0.9rem;
}

/* Result */
.result-card {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Ticket display */
.ticket-section {
    margin-bottom: 18px;
}

.ticket-section-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--yellow);
    padding-bottom: 6px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.ticket-field {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 4px 0;
    font-size: 0.9rem;
}

.ticket-field .label {
    color: var(--text2);
    min-width: 180px;
    flex-shrink: 0;
}

.ticket-field .value {
    color: var(--green);
    font-weight: 500;
    text-align: right;
    word-break: break-all;
}

.ticket-field .value.station {
    color: var(--cyan);
}

.ticket-field .value.warning {
    color: var(--yellow);
}

.ticket-header-bar {
    background: linear-gradient(135deg, var(--accent), #5a4bd1);
    border-radius: 8px;
    padding: 14px 18px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ticket-header-bar .title {
    font-weight: 600;
    font-size: 1.05rem;
}

.ticket-header-bar .provider {
    font-size: 0.85rem;
    opacity: 0.8;
}

.via-station {
    padding: 3px 0 3px 20px;
    color: var(--cyan);
    font-size: 0.88rem;
}

.via-station::before {
    content: '• ';
    color: var(--accent2);
}

.separator {
    height: 1px;
    background: var(--border);
    margin: 16px 0;
}

/* Hex dump */
.hex-dump {
    background: var(--surface2);
    border-radius: 8px;
    padding: 12px;
    font-family: 'Courier New', monospace;
    font-size: 0.78rem;
    color: var(--text3);
    line-height: 1.8;
    word-break: break-all;
    max-height: 200px;
    overflow-y: auto;
}

/* Sample card */
.sample-card {
    border-style: dashed;
}

.sample-card p {
    color: var(--text2);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

/* Loading */
.loading {
    text-align: center;
    padding: 20px;
    color: var(--text2);
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}