/**
 * FREUND - Main Stylesheet
 */

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --color-bg: #1a1a2e;
    --color-bg-card: #16213e;
    --color-bg-input: #0f3460;
    --color-primary: #667eea;
    --color-primary-hover: #764ba2;
    --color-text: #eee;
    --color-text-muted: #9ca3af;
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-error: #ef4444;
    --color-border: #0f3460;
    --color-focus: #667eea;
    --radius: 8px;
    --radius-sm: 4px;
    --transition: 0.2s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
    line-height: 1.5;
}

/* Layout */
.page-center {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

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

/* Cards */
.card {
    background: var(--color-bg-card);
    border-radius: var(--radius);
    padding: 2rem;
}

.card-sm {
    max-width: 400px;
    width: 100%;
}

/* Typography */
.logo {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--color-text-muted);
    text-align: center;
    margin-bottom: 2rem;
}

.env-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--color-warning);
    color: #000;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    margin-top: 0.5rem;
}

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

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--color-bg-input);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    font-size: 1rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input:focus {
    border-color: var(--color-focus);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

.form-input::placeholder {
    color: var(--color-text-muted);
}

.form-input-code {
    font-size: 1.5rem;
    letter-spacing: 0.5rem;
    text-align: center;
    font-family: monospace;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.btn:focus {
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.5);
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
    color: #fff;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-block {
    width: 100%;
}

.btn-link {
    background: none;
    color: var(--color-primary);
    padding: 0.5rem;
}

.btn-link:hover {
    text-decoration: underline;
}

/* Messages */
.message {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.message-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--color-error);
    color: var(--color-error);
}

.message-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--color-success);
    color: var(--color-success);
}

.message-info {
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid var(--color-primary);
    color: var(--color-primary);
}

/* Loading indicator for HTMX */
.htmx-request .btn-text {
    visibility: hidden;
}

.htmx-request .btn-loading {
    display: inline-block;
}

.btn-loading {
    display: none;
}

.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator {
    display: inline-block;
}

.spinner {
    width: 1rem;
    height: 1rem;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 0.5rem;
}

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

/* Dashboard */
.dashboard {
    padding: 2rem 0;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #fff;
}

.user-name {
    font-weight: 500;
}

.user-email {
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

/* Status Grid */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.status-card {
    background: var(--color-bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.status-card-title {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
}

.status-card-value {
    font-size: 1.5rem;
    font-weight: 600;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success { background: var(--color-success); color: #000; }
.badge-warning { background: var(--color-warning); color: #000; }
.badge-error { background: var(--color-error); color: #fff; }

/* Back link */
.back-link {
    display: block;
    text-align: center;
    margin-top: 1rem;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.back-link:hover {
    color: var(--color-primary);
}

.back-link:focus {
    color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.3);
}

/* Visibility utility - high specificity */
body .is-hidden,
html body .is-hidden {
    display: none;
}

/* Text utilities */
.text-center {
    text-align: center;
}

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

/* Spacing utilities */
.mt-1 {
    margin-top: 1rem;
}

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