/* PromptCellar - CSS Styles */

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

:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --background: #0f172a;
    --surface: #1e293b;
    --surface-hover: #334155;
    --border: #334155;
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --text-subtle: #64748b;
    --radius: 8px;
    --radius-lg: 12px;
}

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

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Typography */
h1, h2, h3 {
    font-weight: 600;
    line-height: 1.3;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; margin-top: 2rem; margin-bottom: 1rem; }
h3 { font-size: 1.125rem; margin-bottom: 0.75rem; }

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

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

.btn:hover {
    text-decoration: none;
}

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

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

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

.btn-secondary:hover {
    background: var(--surface-hover);
}

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

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

.btn-small {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-large {
    padding: 0.875rem 2rem;
    font-size: 1rem;
}

.btn-full {
    width: 100%;
}

/* Navigation */
.nav, .dashboard-nav {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
}

.logo:hover {
    text-decoration: none;
    color: var(--primary);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

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

.nav-links a:hover {
    color: var(--text);
}

/* Flash Messages */
.flash-messages {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.flash {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.flash-success { background: var(--success); color: white; }
.flash-error { background: var(--danger); color: white; }
.flash-info { background: var(--secondary); color: white; }

/* Landing Page */
.landing {
    min-height: 100vh;
}

.hero {
    text-align: center;
    padding: 6rem 1.5rem;
    max-width: 800px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1.5rem;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.features, .api-demo, .pricing {
    padding: 4rem 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

.features h2, .api-demo h2, .pricing h2 {
    text-align: center;
    margin-bottom: 3rem;
}

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

.feature {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.feature h3 {
    margin-bottom: 0.5rem;
}

.feature p {
    color: var(--text-muted);
    font-size: 0.9375rem;
}

.api-demo pre {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    overflow-x: auto;
    font-size: 0.875rem;
    border: 1px solid var(--border);
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    max-width: 900px;
    margin: 0 auto;
}

.plan {
    background: var(--surface);
    padding: 2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    text-align: center;
}

.plan-featured {
    border-color: var(--primary);
    position: relative;
}

.plan h3 {
    margin-bottom: 0.5rem;
}

.plan .price {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.plan .price span {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-muted);
}

.plan ul {
    list-style: none;
    margin-bottom: 1.5rem;
    text-align: left;
}

.plan li {
    padding: 0.5rem 0;
    color: var(--text-muted);
}

.plan li::before {
    content: "✓";
    color: var(--success);
    margin-right: 0.5rem;
}

.footer {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

/* Auth Pages */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.auth-container {
    background: var(--surface);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.auth-container .logo {
    display: block;
    margin-bottom: 2rem;
}

.auth-container h2 {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.auth-form {
    text-align: left;
}

.auth-footer {
    margin-top: 1.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.auth-success {
    padding: 1rem 0;
}

/* Forms */
.form-container {
    max-width: 600px;
}

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

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group textarea {
    resize: vertical;
    font-family: monospace;
}

.form-help {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

/* Dashboard */
.dashboard {
    min-height: 100vh;
}

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

.dashboard-header {
    margin-bottom: 2rem;
}

.dashboard-header h1 {
    margin-bottom: 0.5rem;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
}

.back-link {
    display: inline-block;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

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

/* Cards */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.card-link {
    display: block;
    transition: border-color 0.2s;
}

.card-link:hover {
    border-color: var(--primary);
    text-decoration: none;
}

.card h3 {
    color: var(--text);
    margin-bottom: 0.5rem;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table tr:hover {
    background: var(--surface-hover);
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.empty-state h3 {
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* Code & Variables */
code {
    background: var(--background);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.875em;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
}

pre {
    background: var(--background);
    padding: 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: 0.875rem;
}

pre code {
    padding: 0;
    background: none;
}

.var-tag {
    display: inline-block;
    margin: 0.125rem;
    font-size: 0.75rem;
}

/* API Key Display */
.api-key-section {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
}

.api-key-display {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0.75rem 0;
}

.api-key-display code {
    flex: 1;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    word-break: break-all;
}

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

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

.info-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

/* Prompt Display */
.prompt-info {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
}

.current-version {
    margin-bottom: 2rem;
}

.content-display {
    white-space: pre-wrap;
    word-wrap: break-word;
}

.api-usage {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
}

.api-usage pre {
    margin-top: 0.75rem;
}

/* Versions */
.versions-section {
    margin-bottom: 2rem;
}

.versions-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.version-card {
    background: var(--surface);
    padding: 1.25rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.version-current {
    border-color: var(--primary);
}

.version-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.version-number {
    font-weight: 600;
}

.version-date {
    color: var(--text-muted);
    font-size: 0.8125rem;
    margin-left: auto;
}

.version-notes {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

.version-content {
    font-size: 0.8125rem;
    margin-bottom: 0.75rem;
    max-height: 100px;
    overflow: hidden;
}

.version-actions {
    margin-top: 0.5rem;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 4px;
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

/* Settings */
.settings-section {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
}

.settings-section h2 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.125rem;
}

.plan-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

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

.plan-header h3 {
    margin: 0;
}

.plan-limits {
    display: flex;
    gap: 2rem;
    margin-bottom: 1rem;
}

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

.limit-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.limit-value {
    font-weight: 500;
}

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

.api-keys-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.api-key-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--background);
    border-radius: var(--radius);
}

.api-key-item .project-name {
    flex: 1;
    font-weight: 500;
}

/* Danger Zone */
.danger-zone {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.danger-zone h3 {
    color: var(--danger);
}

/* Responsive */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }

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

    .header-row {
        flex-direction: column;
        align-items: stretch;
    }

    .header-actions {
        justify-content: flex-start;
    }

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

    .plan-limits {
        flex-direction: column;
        gap: 1rem;
    }
}
