/* Custom styles for user profile page */

/* Alpine.js cloak - hide until initialized */
[x-cloak] {
    display: none !important;
}

/* Login Card Styles (matching login.html) */
.card {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 20px 40px -8px rgba(74, 21, 105, 0.3), 0 8px 16px -4px rgba(0,0,0,0.1);
}

.icon-bg {
    background: rgba(107, 45, 138, 0.12);
    border: 1.5px solid rgba(107, 45, 138, 0.25);
}

/* Login Container */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1rem;
}

.login-card {
    background: white;
    border-radius: 1rem;
    padding: 3rem;
    text-align: center;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    width: 100%;
}

.login-icon {
    color: #667eea;
    margin-bottom: 1.5rem;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.login-description {
    color: #6b7280;
    margin-bottom: 1.5rem;
}

.btn-login {
    display: inline-block;
    background: #667eea;
    color: white;
    padding: 0.75rem 2rem;
    border-radius: 0.5rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s;
}

.btn-login:hover {
    background: #5568d3;
}

/* App Container */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

/* Header */
.profile-header {
    background: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.user-email {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
}

.role-badge {
    background: #e0e7ff;
    color: #4338ca;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.btn-logout {
    background: white;
    border: 1px solid #d1d5db;
    color: #374151;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: #f3f4f6;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    background: white;
    padding: 0.5rem;
    border-radius: 0.75rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tab {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    color: #6b7280;
    font-weight: 500;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.tab:hover {
    background: #f3f4f6;
}

.tab.active {
    background: linear-gradient(135deg, #6b2d8a 0%, #4a1569 100%);
    color: white;
    box-shadow: 0 2px 6px rgba(74, 21, 105, 0.35);
}

/* Error Banner */
.error-banner {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

/* Tab Content */
.tab-content {
    animation: fadeIn 0.2s ease-in-out;
}

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

/* Cards */
.profile-card, .token-card, .token-list-card, .chart-card, .stat-card {
    background: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 1rem;
}

/* API Docs */
.endpoint-item { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 0.5rem; padding: 1rem; margin-bottom: 0.875rem; }
.endpoint-header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; }
.method-badge { padding: 0.2rem 0.5rem; border-radius: 0.25rem; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.method-badge.get { background: #dbeafe; color: #0369a1; }
.method-badge.post { background: #dcfce7; color: #15803d; }
.method-badge.put { background: #fef3c7; color: #b45309; }
.method-badge.delete { background: #fee2e2; color: #991b1b; }
.method-badge.patch { background: rgba(107,45,138,0.1); color: #6b2d8a; }
.endpoint-path { background: #1e293b; color: #c4b5fd; padding: 0.2rem 0.5rem; border-radius: 0.25rem; font-size: 0.8rem; font-family: monospace; }
.endpoint-desc { color: #4b5563; margin: 0; font-size: 0.875rem; }
.docs-endpoints { max-width: 900px; }

/* Profile Info */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
}

.info-value {
    font-size: 0.875rem;
    color: #1f2937;
}

/* Token Form */
.token-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
}

.form-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-danger {
    padding: 0.625rem 1rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, #6b2d8a 0%, #4a1569 100%);
    border: 1px solid rgba(255,255,255,0.15);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #7c3499 0%, #5a1f7a 100%);
    box-shadow: 0 4px 12px rgba(74, 21, 105, 0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: white;
    border: 1px solid #d1d5db;
    color: #374151;
}

.btn-secondary:hover {
    background: #f3f4f6;
}

.btn-danger {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.btn-danger:hover {
    background: #fecaca;
}

/* Token List */
.tokens-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.token-list-card {
    margin-top: 1rem;
}

.empty-state {
    text-align: center;
    color: #6b7280;
    padding: 2rem;
}

.loading-state {
    text-align: center;
    color: #6b7280;
    padding: 2rem;
}

.token-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
}

.token-item:last-child {
    margin-bottom: 0;
}

.token-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.token-name {
    font-weight: 600;
    color: #1f2937;
}

.token-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.token-prefix {
    background: #f3f4f6;
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-family: monospace;
    color: #4b5563;
}

.token-status {
    font-size: 0.75rem;
    color: #6b7280;
}

.token-status.active {
    color: #059669;
    font-weight: 500;
}

.token-dates {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: #6b7280;
}

.token-actions {
    display: flex;
    gap: 0.5rem;
}

/* Usage Section */
.usage-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.stat-card {
    text-align: center;
    padding: 1.5rem;
}

.stat-label {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #1f2937;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1rem;
}

.chart-container {
    height: 300px;
    position: relative;
}

.chart-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 1rem;
}

/* === Site Header === */
.site-header {
    background: linear-gradient(135deg, #4a1569 0%, #6b2d8a 50%, #3a0f4f 100%);
    border-bottom: 2px solid rgba(255,255,255,0.3);
    padding: 0.625rem 1rem;
    position: relative;
}

.header-pattern {
    position: absolute;
    inset: 0;
    opacity: 0.1;
    pointer-events: none;
    background-image: radial-gradient(circle at 2px 2px, white 1px, transparent 0);
    background-size: 20px 20px;
}

.header-inner {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-divider {
    width: 1px;
    height: 1rem;
    background: rgba(255,255,255,0.3);
    margin: 0 0.25rem;
}

.header-title {
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    letter-spacing: 0.025em;
}

.header-subtitle {
    color: rgba(255,255,255,0.6);
    font-size: 0.75rem;
}

/* === Icon sizing === */
.icon-xl { font-size: 4rem; }
.icon-2xl { font-size: 2rem; }
.icon-lg { font-size: 1.5rem; }
.icon-base { font-size: 1rem; }
.icon-sm { font-size: 0.875rem; }

/* === Profile info grid === */
.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.25rem;
}

.profile-label {
    margin-bottom: 0.375rem;
}

/* === Health badge === */
.health-badge {
    padding: 0.2rem 0.65rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
    border: 1px solid;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.health-badge::before {
    content: '●';
    font-size: 0.55rem;
}

/* === API key input === */
.api-key-input {
    background: #1e293b;
    color: #c4b5fd;
    border: 1px solid #334155;
    border-radius: 0.25rem;
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    font-family: monospace;
    flex: 1;
    min-width: 200px;
    outline: none;
}

/* === Auth block === */
.auth-block {
    background: rgba(107,45,138,0.06);
    border-left: 4px solid #6b2d8a;
    padding: 1rem;
    margin-bottom: 2rem;
    border-radius: 0.5rem;
}

.auth-block-title {
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #4a1569;
    font-size: 0.875rem;
}

/* === Copy button === */
.btn-copy {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: #334155;
    color: #94a3b8;
    border: none;
    border-radius: 0.25rem;
    padding: 0.2rem 0.5rem;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-copy.copied {
    background: #166534;
    color: #86efac;
}

/* === Icon button === */
.btn-icon {
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

/* === Example header === */
.example-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

/* === Code blocks === */
.code-block {
    background: #1e293b;
    color: #c4b5fd;
    padding: 0.5rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    font-size: 0.7rem;
    max-height: 120px;
}

.code-block code {
    margin: 0;
}

/* === Spinning icon === */
.animate-spin {
    animation: spin 1s linear infinite;
}

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

/* === Link accent === */
.link-accent {
    color: #6b2d8a;
    font-weight: 500;
}

.link-accent:hover {
    color: #4a1569;
}

/* Responsive */
@media (max-width: 640px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .token-item {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .token-actions {
        width: 100%;
    }

    .token-actions button {
        flex: 1;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .header-content {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
}
