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

:root {
    --primary-color: #10a37f;
    --primary-hover: #0d8c6a;
    --bg-color: #f7f7f8;
    --card-bg: #ffffff;
    --text-color: #1a1a1a;
    --text-secondary: #6e6e80;
    --border-color: #e5e5e5;
    --error-color: #ef4444;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
}

header {
    text-align: center;
    margin-bottom: 40px;
    padding-top: 40px;
}

h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-color);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 16px;
}

.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 32px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.card h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
}

.card p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    gap: 8px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background-color: var(--bg-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: #ececf1;
}

.btn-link {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 16px;
    font-size: 14px;
}

.btn-link:hover {
    color: var(--text-color);
    text-decoration: underline;
}

.btn-copy {
    background-color: var(--bg-color);
    color: var(--text-color);
    padding: 8px 16px;
    font-size: 14px;
    margin-top: 12px;
}

.btn-copy:hover {
    background-color: #ececf1;
}

/* Code Display */
.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.code-box {
    background-color: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    margin-bottom: 20px;
}

.code-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.code-value {
    font-size: 48px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    letter-spacing: 4px;
    color: var(--primary-color);
    margin: 12px 0;
}

.code-meta {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    background-color: var(--bg-color);
    border-radius: 8px;
    margin-bottom: 20px;
}

.meta-item {
    display: flex;
    gap: 8px;
}

.meta-label {
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 80px;
}

/* Loading Spinner */
.loading {
    text-align: center;
    padding: 40px 0;
}

.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading p {
    margin-top: 16px;
    color: var(--text-secondary);
}

/* States */
.hidden {
    display: none !important;
}

.no-code {
    text-align: center;
    padding: 40px 20px;
}

.no-code p {
    margin-bottom: 12px;
}

.hint {
    font-size: 14px;
    color: var(--text-secondary);
}

.error-box {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 16px;
    color: var(--error-color);
    margin-bottom: 20px;
}

.error-box strong {
    display: block;
    margin-bottom: 4px;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: auto;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#code-display {
    animation: fadeIn 0.3s ease;
}

/* Responsive */
@media (max-width: 640px) {
    .container {
        padding: 16px;
    }

    h1 {
        font-size: 24px;
    }

    .card {
        padding: 24px;
    }

    .code-value {
        font-size: 36px;
        letter-spacing: 2px;
    }

    .code-header {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }

    .code-header .btn-secondary {
        width: 100%;
    }
}

/* Modal para usuario de Telegram */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    max-width: 450px;
    width: 90%;
    text-align: center;
}

.modal-content h2 {
    font-size: 24px;
    margin-bottom: 12px;
    color: var(--text-color);
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.modal-content input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    margin-bottom: 20px;
    transition: border-color 0.2s;
}

.modal-content input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.modal-content .btn {
    width: 100%;
}

.modal-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 16px;
    margin-bottom: 0;
}
