/* Token Download System - Stylesheet */

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

:root {
    --color-bg-primary: #ffffff;
    --color-bg-secondary: #f5f5f5;
    --color-bg-tertiary: #f1eee8;
    --color-text-primary: #2c2c2a;
    --color-text-secondary: #888780;
    --color-text-tertiary: #b4b2a9;
    --color-border: rgba(95, 94, 90, 0.15);
    --color-border-strong: rgba(95, 94, 90, 0.3);
    --color-success: #0F6E56;
    --color-danger: #A32D2D;
    --color-info: #185FA5;
    --border-radius-md: 8px;
    --border-radius-lg: 12px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-bg-primary: #1a1a18;
        --color-bg-secondary: #2d2d2b;
        --color-bg-tertiary: #0f0f0e;
        --color-text-primary: #f5f5f5;
        --color-text-secondary: #a8a8a8;
        --color-text-tertiary: #6b6b6b;
        --color-border: rgba(255, 255, 255, 0.1);
        --color-border-strong: rgba(255, 255, 255, 0.2);
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
    line-height: 1.6;
    font-size: 16px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.container-narrow {
    max-width: 500px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
header {
    background: var(--color-bg-primary);
    border-bottom: 0.5px solid var(--color-border);
    padding: 1.5rem 2rem;
    margin-bottom: 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* Offset anchor targets so sticky header doesn't cover them */
[id] {
    scroll-margin-top: 90px;
}

header h1 {
    font-size: 24px;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

header p {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin: 0;
}

/* Navigation */
nav {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

nav a {
    color: var(--color-text-primary);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: var(--border-radius-md);
    border: 0.5px solid var(--color-border-strong);
    font-size: 14px;
    transition: background-color 0.2s;
}

nav a:hover {
    background: var(--color-bg-secondary);
}

/* Cards */
.card {
    background: var(--color-bg-primary);
    border: 0.5px solid var(--color-border);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.card h2 {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 1.5rem;
}

.card h3 {
    font-size: 16px;
    font-weight: 500;
    margin: 1.5rem 0 1rem 0;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    font-size: 13px;
    color: var(--color-text-secondary);
    font-weight: 500;
    margin-bottom: 8px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border: 0.5px solid var(--color-border);
    border-radius: var(--border-radius-md);
    font-size: 14px;
    font-family: inherit;
    color: var(--color-text-primary);
    background: var(--color-bg-primary);
    transition: border-color 0.2s;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-border-strong);
    box-shadow: 0 0 0 3px rgba(95, 94, 90, 0.1);
}

input[type="text"].mono {
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* Buttons */
button,
.btn,
input[type="submit"] {
    padding: 12px 24px;
    background: var(--color-bg-primary);
    border: 0.5px solid var(--color-border-strong);
    color: var(--color-text-primary);
    border-radius: var(--border-radius-md);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s, transform 0.1s;
}

button:hover,
.btn:hover,
input[type="submit"]:hover {
    background: var(--color-bg-secondary);
}

button:active,
.btn:active,
input[type="submit"]:active {
    transform: scale(0.98);
}

button.primary,
.btn.primary {
    background: var(--color-info);
    color: white;
    border-color: var(--color-info);
}

button.primary:hover,
.btn.primary:hover {
    background: #0d3a7a;
}

button.danger,
.btn.danger {
    background: var(--color-danger);
    color: white;
    border-color: var(--color-danger);
}

button.danger:hover,
.btn.danger:hover {
    background: #7a1f1f;
}

button.success,
.btn.success {
    background: var(--color-success);
    color: white;
    border-color: var(--color-success);
}

button.success:hover,
.btn.success:hover {
    background: #084a35;
}

button.full-width {
    width: 100%;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

table th {
    background: var(--color-bg-secondary);
    padding: 12px;
    text-align: left;
    font-weight: 500;
    color: var(--color-text-secondary);
}

table td {
    padding: 12px;
    border-bottom: 0.5px solid var(--color-border);
}

table tr:hover {
    background: var(--color-bg-secondary);
}

.table-wrapper {
    overflow-x: auto;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--border-radius-md);
    margin-bottom: 1.5rem;
    font-size: 14px;
}

.alert.success {
    background: #EAF3DE;
    color: #3B6D11;
    border: 0.5px solid #97C459;
}

.alert.error {
    background: #FCEBEB;
    color: #A32D2D;
    border: 0.5px solid #F09595;
}

.alert.info {
    background: #E6F1FB;
    color: #185FA5;
    border: 0.5px solid #85B7EB;
}

/* Login page */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #f8f7f2 0%, #f5f3ed 100%);
}

.login-box {
    background: var(--color-bg-primary);
    border: 0.5px solid var(--color-border);
    border-radius: var(--border-radius-lg);
    padding: 2.5rem;
    max-width: 400px;
    width: 100%;
}

.login-box h1 {
    font-size: 28px;
    font-weight: 500;
    margin-bottom: 0.5rem;
    text-align: center;
}

.login-box p {
    font-size: 14px;
    color: var(--color-text-secondary);
    text-align: center;
    margin-bottom: 2rem;
}

/* Redeem page */
.redeem-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #f8f7f2 0%, #f5f3ed 100%);
}

.redeem-box {
    background: var(--color-bg-primary);
    border: 0.5px solid var(--color-border);
    border-radius: var(--border-radius-lg);
    padding: 2.5rem;
    max-width: 500px;
    width: 100%;
}

.redeem-box h1 {
    font-size: 28px;
    font-weight: 500;
    margin-bottom: 8px;
    text-align: center;
}

.redeem-box > p {
    font-size: 14px;
    color: var(--color-text-secondary);
    text-align: center;
    margin-bottom: 2rem;
}

/* State messages */
.state-box {
    display: none;
    margin-top: 2rem;
    padding: 1.5rem;
    border-radius: var(--border-radius-md);
}

.state-box.success,
.state-box.error {
    display: block;
}

.state-box.success {
    background: var(--color-bg-secondary);
}

.state-box.error {
    background: #FCEBEB;
    border: 0.5px solid #F09595;
}

.state-content {
    display: flex;
    gap: 12px;
}

.state-icon {
    font-size: 20px;
    flex-shrink: 0;
    line-height: 1.4;
}

.state-box.success .state-icon {
    color: var(--color-success);
}

.state-box.error .state-icon {
    color: var(--color-danger);
}

.state-text p {
    margin: 0;
    font-size: 14px;
}

.state-text p:first-child {
    font-weight: 500;
}

.state-box.success p:first-child {
    color: var(--color-text-primary);
}

.state-box.error p:first-child {
    color: var(--color-danger);
}

.state-text p:last-child {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-top: 4px;
}

/* Info section */
.info-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 0.5px solid var(--color-border);
}

.info-section p {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin: 0;
    line-height: 1.6;
}

.info-section strong {
    color: var(--color-text-primary);
}

/* Grid */
.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 900px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }
}

/* Utility classes */
.text-center {
    text-align: center;
}

.text-muted {
    color: var(--color-text-secondary);
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.error-text {
    color: var(--color-danger);
    font-size: 12px;
}
