/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #2d2d2d;
    --btn-primary: #2d3748;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --accent-primary: #10a37f;
    --accent-secondary: #1a73e8;
    --border-color: #3d3d3d;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

.app-container {
    min-height: 100vh;
}

.text-center {
    text-align: center;
}

#generateBtn {
    position: absolute;
    bottom: 19px;
    right: 11px;
}

.button-ai {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
}

.logout-btn {
    background: #6b0606;
    color: #fae6e6;
    padding: 6px 10px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: medium;
}

/* Navigation */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-primary);
}

.nav-brand i {
    color: var(--accent-primary);
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s;
    width: -webkit-fill-available;
}

.nav-link:hover {
    color: var(--text-primary);
}
#modelSelect {
    background: rgba(30, 30, 40, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.5rem 2rem 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    appearance: none;
    background-image: url(data:image/svg+xml;charset=utf-8;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHdpZHRoPScxMicgaGVpZ2h0PScxMicgdmlld0JveD0nMCAwIDEyIDEyJz48cGF0aCBmaWxsPSd3aGl0ZScgZD0nTTYgOUwxIDRoMTB6Jy8+PC9zdmc+);
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
}
/* Hero Section */
.hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    padding: 1rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
    align-items: center;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.gradient-text {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.hero-actions {
    display: flex;
    gap: 1rem;
}

button .nav-link
 {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    cursor: pointer;
}

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

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

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* Code Preview */
.code-preview {
    height: 470px;
    max-height: 50vh; /* Limit height to 50% of viewport height */
    background-color: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    width: 100%;
    min-height: 480px; /* Minimum height for mobile */
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.code-dots {
    display: flex;
    gap: 0.5rem;
}

.code-dots span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--text-secondary);
}

.code-dots span:first-child {
    background-color: #ff5f57;
}

.code-dots span:nth-child(2) {
    background-color: #ffbd2e;
}

.code-dots span:last-child {
    background-color: #28ca42;
}

.code-content {
    padding: 1.5rem;
    overflow-x: auto; /* Allow horizontal scrolling if needed */
}

.code-content pre {
    margin: 0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap; /* Wrap long lines */
    word-wrap: break-word; /* Break long words */
    overflow-x: auto; /* Allow horizontal scrolling if still needed */
}

.code-content code {
    color: #50fa7b;
}

/* Features Section */
.features {
    padding: 4rem 2rem;
    background-color: var(--bg-secondary);
}

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

.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
}

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

.feature-card {
    background-color: var(--bg-primary);
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    border: 1px solid var(--border-color);
    transition: transform 0.3s;
}

.feature-card:hover {
    transform: translateY(-5px);
}

.feature-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: var(--gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
}

.feature-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.feature-card p {
    color: var(--text-secondary);
}

/* Auth Pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-secondary);
    padding: 2rem;
}

.auth-card {
    background-color: var(--bg-primary);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 400px;
}

.auth-title {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

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

.label {
    display: block;
    font-weight: 600;
}

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

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

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.3s;
    resize: none;
}

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

.form-static {
    padding: 0.75rem 1rem;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
}

.auth-link {
    text-align: center;
    margin-top: 1.5rem;
}

.auth-link a {
    color: var(--accent-primary);
    text-decoration: none;
}

/* Dashboard */
.dashboard {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

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

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.project-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
}

.project-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-primary);
}

.project-header {
    display: flex;
    justify-content: between;
    align-items: start;
    margin-bottom: 1rem;
}

.project-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.project-date {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.project-preview {
    background-color: var(--bg-tertiary);
    height: 120px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    color: var(--text-secondary);
    overflow: hidden;
    padding: 0.5rem;
    font-size: 0.75rem;
    line-height: 1.2;
}

.project-snippet {
    font-family: 'Monaco', 'Menlo', monospace;
    white-space: pre-wrap;
    text-align: left;
    width: 100%;
}

/* Workspace */
.workspace {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: calc(100vh - 65px); /* Full height minus navbar */
}

.panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.output-panel .panel-header {
    padding: 6px 1rem;
}

.panel-header {
    padding: 1rem;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.panel-content, .tab-content {
    flex-grow: 1;
    padding: 10px;
    overflow: auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

#codeTab {
    padding: 0;
}

.code-editor {
    flex-grow: 1;
    width: 100%;
    background-color: var(--bg-tertiary);
    border: none;
    color: var(--text-primary);
    font-family: 'Monaco', 'Menlo', monospace;
    resize: none;
    padding: 1rem;
}

#previewTab {
    padding: 0;
    background-color: #000;
}

#preview-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Tabs */
.tabs {
    display: flex;
    align-items: stretch;
}

.tab-link {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 1rem 1.5rem;
    cursor: pointer;
    font-size: 1rem;
    border-bottom: 3px solid transparent;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.tab-link.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.tab-content {
    display: none;
}

/* Profile Page Styles */
.profile-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

.profile-header {
    text-align: center;
    margin-bottom: 3rem;
}

.profile-section {
    margin-bottom: 3rem;
}

.profile-section h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.profile-card {
    background-color: var(--bg-secondary);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.api-key-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.api-key-container .form-input {
    flex: 1;
    min-width: 200px;
}

.api-key-warning {
    color: #f56565;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Billing Table */
.billing-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto; /* Allows columns to adjust based on content */
}

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

.billing-table th {
    font-weight: 600;
    color: var(--text-secondary);
}

/* Make amount column more compact */
.billing-table .amount {
    font-weight: 600;
    min-width: 80px; /* Prevent amount column from getting too narrow */
}

.amount.positive {
    color: #48bb78;
}

.amount.negative {
    color: #f56565;
}

.tx-type {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.tx-type.deposit {
    background-color: #48bb7833;
    color: #48bb78;
}

.tx-type.usage {
    background-color: #f5656533;
    color: #f56565;
}

/* Responsive Table for Mobile */
@media (max-width: 768px) {
    .billing-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    .billing-table,
    .billing-table thead,
    .billing-table tbody,
    .billing-table th,
    .billing-table td,
    .billing-table tr {
        display: block;
    }

    .billing-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .billing-table tr {
        border: 1px solid var(--border-color);
        margin-bottom: 1rem;
        padding: 0.5rem;
        background-color: var(--bg-tertiary);
        border-radius: 8px;
    }

    .billing-table tr td {
        border: none;
        border-bottom: 1px solid var(--border-color);
        position: relative;
        padding: 0.5rem 0.5rem 0.5rem 35%;
        text-align: left;
        text-wrap: auto;
    }

    .billing-table tr td:last-child {
        border-bottom: none;
    }

    .billing-table tr td:before {
        content: attr(data-label) ": ";
        position: absolute;
        left: 0.5rem;
        width: 30%;
        padding-right: 0.5rem;
        white-space: nowrap;
        font-weight: 600;
        color: var(--text-secondary);
    }

    .billing-table .amount {
        font-size: 0.9rem;
    }

    .api-key-container {
        flex-direction: column;
        gap: 0.5rem;
    }

    .api-key-container .form-input {
        min-width: auto;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .billing-table tr td {
        padding: 0.5rem 0.5rem 0.5rem 40%;
    }

    .billing-table tr td:before {
        width: 35%;
    }

    .billing-table th,
    .billing-table td {
        padding: 0.5rem;
    }

    .api-key-container {
        gap: 0.5rem;
    }

    .api-key-container .form-input {
        width: 100%;
    }
}

/* Toast Notifications */
.toast {
    position: fixed;
    top: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    color: white;
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

.toast-success {
    background-color: #48bb78;
}

.toast-error {
    background-color: #f56565;
}

.toast-info {
    background-color: #4299e1;
}

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

/* Pricing Page Styles */
.pricing-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.pricing-header {
    text-align: center;
    margin-bottom: 4rem;
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 4rem;
}

.pricing-card {
    background-color: var(--bg-secondary);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    position: relative;
    transition: transform 0.3s;
}

.pricing-card:hover {
    transform: translateY(-5px);
}

.pricing-card.featured {
    border-color: var(--accent-primary);
    transform: scale(1.05);
}

.popular-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gradient);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.pricing-card .pricing-header {
    text-align: center;
    margin-bottom: 2rem;
}

.price {
    margin: 1rem 0;
}

.amount-pricing {
    font-size: 3rem;
}

.amount {
    font-size: 1rem;
    font-weight: bold;
}

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

.features-list {
    list-style: none;
    margin: 2rem 0;
}

.features-list li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.features-list .fa-check {
    color: #48bb78;
}

.features-list .fa-times {
    color: #f56565;
}

/* Token Packages */
.custom-tokens-section {
    margin-bottom: 4rem;
}

.section-header {
    text-align: center;
    margin-bottom: 2rem;
}

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

.token-package {
    background-color: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.token-package:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.token-package.custom {
    border-style: dashed;
}

.token-amount {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.token-bonus {
    color: #48bb78;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.token-total {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Model Pricing Table */
.model-pricing-table {
    overflow-x: auto;
}

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

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

.model-id {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

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

.modal-content {
    background-color: var(--bg-primary);
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    border: 1px solid var(--border-color);
}

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

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
}

.payment-summary {
    background-color: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.summary-item.total {
    border-top: 1px solid var(--border-color);
    padding-top: 0.5rem;
    margin-top: 0.5rem;
    font-weight: bold;
}

.summary-item.bonus {
    color: #48bb78;
}

.payment-methods {
    margin-bottom: 2rem;
}

.method-options {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.method-option {
    flex: 1;
    text-align: center;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.method-option input {
    display: none;
}

.method-option:has(input:checked) {
    border-color: var(--accent-primary);
    background-color: var(--accent-primary) + '20';
}

.flex-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.cost-estimate {
    font-size: 12px;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    font-size: 1rem;
    border-radius: 50%;
}

.btn-icon:hover {
    background-color: var(--bg-tertiary);
    color: #f56565;
}

/* Success Overlay */
.success-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.payment-success {
    background-color: var(--bg-primary);
    padding: 3rem;
    border-radius: 12px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.success-icon {
    font-size: 4rem;
    color: #48bb78;
    margin-bottom: 1rem;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.no-data {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    margin-left: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block;
    }

    .navbar {
        position: relative;
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .nav-brand {
        z-index: 1001; /* Keep brand visible above menu */
    }

    .nav-links {
        position: absolute;
        padding: 12px;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: var(--bg-secondary);
        flex-direction: column;
        align-items: center;
        padding: 1rem;
        gap: 1rem;
        border: 1px solid var(--border-color);
        border-top: none;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        transition: all 0.3s ease;
        z-index: 1000;
    }

    .nav-links.mobile-menu-open {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .mobile-menu-btn {
        position: absolute;
        right: 1rem;
        top: 1rem;
        z-index: 1001;
    }

    .hero {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1rem;
        text-align: center;
    }

    .hero-content {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .hero-title {
        font-size: 2.2rem;
        line-height: 1.3;
        margin-bottom: 1rem;
    }

    .hero-subtitle {
        font-size: 0.95rem;
        margin-bottom: 1.5rem;
        text-align: center;
    }

    .hero-actions {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
        width: 100%;
    }

    .btn {
        width: 100%;
        max-width: 300px;
        justify-content: center;
        padding: 0.75rem 1.5rem;
    }

    .code-preview {
        width: 100%;
        max-width: 100%;
        height: 500px;
        max-height: 50vh; /* Limit height to 30% of viewport height on mobile */
    }

    .code-content {
        font-size: 0.8rem;
        padding: 1rem; /* Reduced padding on mobile */
    }

    .code-content pre {
        font-size: 0.75rem; /* Smaller font on mobile */
        overflow-x: auto;
        white-space: pre-wrap;
        word-wrap: break-word;
    }

    .section-title {
        font-size: 2rem;
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .auth-container {
        padding: 1rem;
    }

    .auth-card {
        padding: 1.5rem;
        max-width: 100%;
    }

    .dashboard {
        padding: 1rem;
    }

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

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

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

    .workspace {
        grid-template-columns: 1fr;
        height: auto;
        min-height: calc(100vh - 120px);
        flex-direction: column;
    }

    .panel {
        min-height: 47vh;
    }

    .panel-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .output-panel .panel-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 0.5rem 1rem;
    }

    .tabs {
        width: 100%;
        overflow-x: auto;
        margin-bottom: 1rem;
    }

    .tab-link {
        white-space: nowrap;
        padding: 0.75rem 1rem;
    }

    .code-actions {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .code-actions .btn {
        flex: 1;
        min-width: 80px;
        padding: 0.5rem;
        font-size: 0.9rem;
    }

    .code-actions .btn i {
        margin-right: 0.25rem;
    }

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

    .token-packages {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        padding: 1.5rem;
    }

    .method-options {
        flex-direction: column;
        gap: 0.5rem;
    }

    .method-option {
        padding: 1rem;
    }

    /* Additional mobile optimizations */
    .code-dots {
        display: none;
    }

    .flex-box {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .cost-estimate {
        margin: 0.5rem 0;
    }

    .estimate-item {
        display: flex;
        justify-content: space-between;
        width: 100%;
    }

    .form-group-ai {
        padding: 0.5rem 0;
    }
}

@media (max-width: 480px) {
    .navbar {
        padding: 1.2rem;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 0.9rem;
    }

    .btn {
        padding: 0.75rem 1rem;
    }

    .code-preview {
        height: 500px;
        max-height: 48vh; /* Limit height on very small screens */
    }

    .code-content {
        padding: 0.75rem;
        overflow-x: auto;
    }

    .code-content pre {
        font-size: 0.7rem; /* Even smaller font on very small screens */
        white-space: pre-wrap;
        word-wrap: break-word;
    }

    .feature-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }

    .feature-card h3 {
        font-size: 1.25rem;
    }

    .auth-card {
        padding: 1rem;
    }

    .form-input {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .project-card {
        padding: 1rem;
    }

    .panel-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 0.75rem;
    }

    .panel-header h3 {
        font-size: 1.1rem;
    }

    .code-editor {
        padding: 0.5rem;
        font-size: 0.8rem;
    }

    .pricing-card {
        padding: 1.5rem;
    }

    .amount {
        font-size: 2.5rem;
    }

    #generateBtn {
        position: absolute;
        width: 48px;
        height: 48px;
        margin-top: 1rem;
        bottom: 30px;
        right: 15px;
    }

    .form-input {
        padding: 0.75rem;
        font-size: 1rem;
        min-height: 44px; /* Ensure minimum touch target size */
    }

    .form-label {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }

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

    .btn {
        min-height: 44px;
        padding: 0.75rem 1.5rem;
    }
}