/* XiaoYang.IDKey - Styles */
:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-card: #1a1f26;
    --bg-input: #21262d;
    --accent: #00d4ff;
    --accent-hover: #00b8e6;
    --accent-glow: rgba(0, 212, 255, 0.3);
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --border: #30363d;
    --success: #3fb950;
    --warning: #d29922;
    --error: #f85149;
    --gradient: linear-gradient(135deg, #00d4ff 0%, #00ff88 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.logo-accent {
    color: var(--accent);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.lang-switch {
    display: flex;
    align-items: center;
}

.lang-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 20px;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.lang-toggle:hover {
    border-color: var(--accent);
}

.lang-toggle .globe {
    font-size: 1rem;
}

.lang-toggle .lang-text {
    font-weight: 500;
    color: var(--accent);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border-radius: 8px;
}

.user-email {
    color: var(--accent);
    font-weight: 500;
}

.user-credits {
    color: var(--warning);
    font-weight: 600;
}

/* Buttons */
.btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--accent);
    color: var(--bg-primary);
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 0 20px var(--accent-glow);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-logout {
    background: var(--error);
    color: white;
}

.btn-small {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1rem;
}

.btn-full {
    width: 100%;
    justify-content: center;
}

/* Main Content */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Hero Section */
.hero {
    text-align: center;
    margin-bottom: 2rem;
}

.hero-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.accent {
    color: var(--accent);
}

.hero-subtitle {
    color: var(--accent);
    font-size: 1.125rem;
    letter-spacing: 2px;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--accent);
}

/* Credits Rules */
.rules-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.rule-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.rule-icon {
    font-size: 1.25rem;
}

.rule-name {
    flex: 1;
    color: var(--text-primary);
}

.rule-cost {
    color: var(--accent);
    font-weight: 600;
    font-size: 1.125rem;
}

.rules-note {
    color: var(--warning);
    font-size: 0.875rem;
    text-align: center;
}

/* Service Status */
.status-tabs {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.status-tab {
    flex: 1;
    min-width: 200px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: default;
    transition: all 0.2s;
}

.status-tab:focus {
    outline: none;
}

.status-tab .status-name {
    color: var(--text-primary);
}

.status-icon {
    font-size: 1.5rem;
}

.status-badge {
    margin-left: auto;
    padding: 0.375rem 1rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-normal {
    background: var(--success);
    color: white;
}

.status-stopped {
    background: var(--error);
    color: white;
}

.status-warning {
    background: rgba(210, 153, 34, 0.2);
    color: var(--warning);
}

/* Verify Sections */
.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--accent);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

.status-dot.active {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.link-btn {
    display: block;
    text-align: center;
    padding: 1rem;
    background: linear-gradient(90deg, rgba(0, 212, 255, 0.1), rgba(0, 255, 136, 0.1));
    border: 1px solid var(--accent);
    border-radius: 8px;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    margin-bottom: 1rem;
    transition: all 0.2s;
}

.link-btn:hover {
    background: linear-gradient(90deg, rgba(0, 212, 255, 0.2), rgba(0, 255, 136, 0.2));
    box-shadow: 0 0 20px var(--accent-glow);
}

.tips-box {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 1rem;
}

.tips-box h4 {
    color: var(--warning);
    margin-bottom: 0.75rem;
}

.tips-box p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.text-warning {
    color: var(--warning);
}

.text-accent {
    color: var(--accent);
}

.text-success {
    color: var(--success);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
}

/* Two Column Layout */
.two-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .two-column {
        grid-template-columns: 1fr;
    }
}

/* Verify Tabs */
.verify-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.verify-tab {
    flex: 1;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.verify-tab:hover,
.verify-tab.active {
    border-color: var(--accent);
    color: var(--accent);
}

/* Input Group */
.input-group {
    margin-bottom: 1rem;
}

.input-group textarea {
    width: 100%;
    padding: 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    resize: vertical;
}

.input-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

/* Log Container */
.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.log-container {
    height: 250px;
    overflow-y: auto;
    background: var(--bg-primary);
    border-radius: 8px;
    padding: 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.8125rem;
}

.log-empty {
    color: var(--text-muted);
    text-align: center;
    padding: 2rem;
}

.log-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.log-time {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.log-message {
    color: var(--text-primary);
}

.log-success {
    color: var(--success);
}

.log-error {
    color: var(--error);
}

/* Footer */
.footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 90%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-large {
    max-width: 600px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-tabs {
    display: flex;
    gap: 2rem;
}

.modal-tab {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    padding-bottom: 0.5rem;
    transition: all 0.2s;
}

.modal-tab.active {
    color: var(--accent);
    border-bottom: 2px solid var(--accent);
}

.modal-title {
    color: var(--accent);
    font-size: 1.125rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: var(--error);
}

.modal-body {
    padding: 1.5rem;
}

.modal-desc {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.modal-example {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    font-family: monospace;
}

/* Auth Forms */
.auth-form .form-group {
    margin-bottom: 1rem;
}

.auth-form input {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--accent);
}

.input-with-btn {
    display: flex;
    gap: 0.5rem;
}

.input-with-btn input {
    flex: 1;
}

/* User Center */
.user-center-info {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.info-item {
    text-align: center;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.info-label {
    display: block;
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
}

.info-value {
    color: var(--accent);
    font-weight: 600;
}

.history-list {
    max-height: 300px;
    overflow-y: auto;
}

.history-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
}

.history-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

/* Toast */
#toastContainer {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.toast {
    padding: 1rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease;
    min-width: 200px;
    text-align: center;
}

.toast-success {
    border-color: var(--success);
}

.toast-error {
    border-color: var(--error);
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 1rem;
    }

    .header-right {
        flex-wrap: wrap;
        justify-content: center;
    }

    .hero-title {
        font-size: 2rem;
    }

    .action-buttons {
        flex-direction: column;
    }

    .user-center-info {
        grid-template-columns: 1fr;
    }
}

/* Improved Redeem Modal */
.redeem-modal .modal-content {
    background: linear-gradient(180deg, #1a1f26 0%, #0d1117 100%);
    border: 2px solid #2a3441;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.redeem-modal .modal-header {
    background: transparent;
    border-bottom: 2px solid var(--accent);
    padding: 1.5rem;
}

.redeem-modal .modal-title {
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.redeem-modal .modal-body {
    padding: 1.5rem;
}

.redeem-textarea {
    width: 100%;
    min-height: 200px;
    background: #0d1117;
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 1rem;
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    resize: vertical;
    outline: none;
    margin-bottom: 1rem;
}

.redeem-textarea::placeholder {
    color: var(--text-muted);
    white-space: pre-line;
}

.redeem-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}

/* Service Disabled State */
.service-disabled {
    opacity: 0.6;
    pointer-events: none;
}

.service-disabled .input-group textarea,
.service-disabled .btn {
    cursor: not-allowed;
}

.service-disabled-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(13, 17, 23, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    z-index: 10;
}

.service-disabled-text {
    color: var(--error);
    font-weight: 600;
    font-size: 1.125rem;
}