/* --- SECTION -1: RESET & VARIABLES --- */
:root {
    /* Material 3 Dark Expressive Palette */
    --md-sys-color-background: #0A0A0A;
    --md-sys-color-on-background: #E1E3E1;
    --md-sys-color-surface: #141414;
    --md-sys-color-surface-container: #1E1E1E;
    --md-sys-color-surface-container-high: #2A2A2A;
    --md-sys-color-primary: #82CFFF;
    --md-sys-color-on-primary: #00344F;
    --md-sys-color-secondary-container: #004A77;
    --md-sys-color-on-secondary-container: #C2E7FF;
    --md-sys-color-tertiary-container: #3A3A3A; /* For neutral data blocks */
    --md-sys-color-error: #FFB4AB;
    --md-sys-color-error-container: #93000A;
    --md-sys-color-outline: #8C9199;
    --md-sys-color-outline-variant: #444746;

    /* Animation Physics */
    --motion-spring-expressive: cubic-bezier(0.3, 1.5, 0.5, 1);
    --motion-duration: 0.5s;
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--md-sys-color-background);
    color: var(--md-sys-color-on-background);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
}

button, input, textarea {
    font-family: inherit;
    border: none;
    outline: none;
}

/* --- LAYOUT --- */
.app-container {
    width: 100%;
    max-width: 560px; /* Optimal reading width for this app type */
    display: flex;
    flex-direction: column;
    gap: 32px; /* Large spacing between major sections */
}

/* --- HERO SECTION --- */
.hero-section {
    text-align: center;
    animation: slideDown 0.8s var(--motion-spring-expressive);
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    background-color: var(--md-sys-color-surface-container-high);
    border-radius: 24px;
    margin-bottom: 24px;
}

.brand-mark .material-symbols-rounded {
    font-size: 32px;
    color: var(--md-sys-color-primary);
}

.hero-title {
    font-size: 40px;
    font-weight: 800;
    letter-spacing: -1.5px;
    margin: 0 0 12px 0;
    line-height: 1;
    background: linear-gradient(135deg, var(--md-sys-color-on-background) 0%, var(--md-sys-color-outline) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 16px;
    color: var(--md-sys-color-outline);
    margin: 0;
}

/* --- SEARCH SECTION --- */
.input-group {
    display: flex;
    gap: 12px;
    background-color: var(--md-sys-color-surface-container);
    padding: 8px;
    border-radius: 24px; /* Large container radius */
    border: 1px solid var(--md-sys-color-outline-variant);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.input-group:focus-within {
    border-color: var(--md-sys-color-primary);
    box-shadow: 0 0 0 4px rgba(130, 207, 255, 0.1);
}

.input-wrapper {
    flex-grow: 1;
    display: flex;
    align-items: center;
    padding-left: 16px;
    color: var(--md-sys-color-outline);
}

.input-icon {
    margin-right: 12px;
    font-size: 24px;
}

#user-id {
    width: 100%;
    background: transparent;
    color: var(--md-sys-color-on-background);
    font-size: 18px;
    font-weight: 500;
    padding: 12px 0;
}

#user-id::placeholder {
    color: var(--md-sys-color-outline-variant);
}

.btn-primary {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    padding: 16px 24px;
    border-radius: 16px; /* Medium element radius */
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s var(--motion-spring-expressive), filter 0.2s ease;
}

.btn-primary:hover {
    filter: brightness(1.1);
}

.btn-primary:active {
    transform: scale(0.95);
}

/* --- ERROR & LOADER --- */
.error-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: var(--md-sys-color-error-container);
    color: var(--md-sys-color-error);
    padding: 16px;
    border-radius: 16px;
    margin-top: 16px;
    font-weight: 500;
    animation: shake 0.4s var(--motion-spring-expressive);
}

.loader-container {
    display: flex;
    justify-content: center;
    padding: 40px 0;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--md-sys-color-surface-container-high);
    border-top-color: var(--md-sys-color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* --- RESULTS SECTION --- */
.results-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s ease, transform 0.6s var(--motion-spring-expressive);
}

.results-section.visible {
    opacity: 1;
    transform: translateY(0);
}

.card {
    background-color: var(--md-sys-color-surface-container);
    border-radius: 28px; /* Large container radius */
    padding: 24px;
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    color: var(--md-sys-color-primary);
}

.card-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    color: var(--md-sys-color-on-background);
}

/* Data Grid for Info */
.data-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.data-item {
    background-color: var(--md-sys-color-surface-container-high);
    padding: 16px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.data-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--md-sys-color-outline);
    font-weight: 700;
}

.data-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--md-sys-color-on-background);
    word-break: break-word;
}

.data-value.highlight {
    color: var(--md-sys-color-primary);
}

/* VLESS Special Card */
.vless-card {
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

.vless-card .card-title,
.vless-card .card-header .material-symbols-rounded {
    color: var(--md-sys-color-on-secondary-container);
}

.vless-box {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    padding: 16px;
    font-family: 'Roboto Mono', monospace;
    font-size: 14px;
    color: var(--md-sys-color-on-secondary-container);
    word-break: break-all;
    max-height: 120px;
    overflow-y: auto;
    margin-bottom: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-copy {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 16px;
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border-radius: 16px;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s var(--motion-spring-expressive);
}

.btn-copy:active {
    transform: scale(0.97);
}

/* Accordion */
.accordion {
    background-color: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-outline-variant);
}

.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 20px 24px;
    background: none;
    color: var(--md-sys-color-on-background);
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
}

.accordion-icon {
    transition: transform 0.4s var(--motion-spring-expressive);
}

.accordion.active .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s var(--motion-spring-expressive);
    padding: 0 24px;
}

.accordion.active .accordion-content {
    padding-bottom: 24px;
}

/* Animations */
@keyframes spin { 100% { transform: rotate(360deg); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-40px); } to { opacity: 1; transform: translateY(0); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

/* Responsive adjustments */
@media (max-width: 600px) {
    .hero-title { font-size: 32px; }
    .data-grid { grid-template-columns: 1fr; }
    .btn-label { display: none; } /* Icon only button on very small screens if needed, but keeping text for now */
}