/* ===== MeuCerebro - Main Styles ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

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

:root {
    --primary: #1a56db;
    --primary-dark: #1340a8;
    --primary-light: #e8f0fe;
    --bg: #f8fafc;
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-active: #ffffff;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overscroll-behavior-y: none;
}

html {
    overscroll-behavior: none;
}

/* ===== Layout ===== */
.app-layout {
    display: flex;
}

/* ===== Sidebar ===== */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 24px;
}

.sidebar-brand-icon {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.sidebar-brand h1 {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}

.sidebar-brand span {
    font-size: 11px;
    color: var(--sidebar-text);
    display: block;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-nav {
    flex: 1;
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 4px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.sidebar-nav a:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.sidebar-nav a.active {
    background: var(--primary);
    color: #fff;
}

.sidebar-nav a .icon {
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.sidebar-nav a .badge {
    margin-left: auto;
    background: rgba(255,255,255,0.15);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 16px;
    margin-top: 16px;
}

.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.sidebar-footer a:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 32px 40px;
    max-width: 100%;
    min-width: 0;
    overflow-wrap: break-word;
}

/* ===== Header Section ===== */
.page-header {
    margin-bottom: 32px;
}

.page-header-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--primary);
    margin-bottom: 8px;
}

.page-header h2 {
    font-size: 32px;
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
}

.page-header h2 strong {
    color: var(--text);
}

.page-header p {
    color: var(--text-light);
    margin-top: 8px;
    font-size: 15px;
}

/* ===== Top Bar (Credits + user) ===== */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    margin-bottom: 24px;
}

.credits-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.credits-badge .icon {
    color: var(--warning);
}

.btn-buy-credits {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-buy-credits:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ===== Stats Cards ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.2s;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.stat-card .stat-icon {
    width: 44px;
    height: 44px;
    background: var(--primary-light);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--primary);
}

.stat-card .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
}

.stat-card .stat-label {
    font-size: 12px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== Tabs ===== */
.tabs {
    display: flex;
    gap: 4px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 24px;
    width: fit-content;
}

.tab-btn {
    padding: 8px 20px;
    border: none;
    background: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.tab-btn:hover {
    color: var(--text);
    background: var(--bg);
}

.tab-btn.active {
    background: var(--primary);
    color: #fff;
}

/* ===== Cards ===== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
}

.balance-card {
    display: flex;
    align-items: center;
    gap: 20px;
}

@media (max-width: 768px) {
    .balance-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .balance-card .balance-amount {
        font-size: 22px !important;
    }
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.card-subtitle {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 20px;
}

/* ===== Form Styles ===== */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.form-label .icon {
    font-size: 14px;
    color: var(--text-light);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1);
}

.form-input::placeholder {
    color: #94a3b8;
}

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

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* ===== Range Slider ===== */
.range-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.form-range {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border);
    border-radius: 3px;
    outline: none;
}

.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
}

.range-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    min-width: 80px;
    text-align: right;
}

/* ===== Keywords Tags ===== */
.keywords-input-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.keyword-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--primary-light);
    color: var(--primary);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.keyword-tag:hover {
    background: var(--primary);
    color: #fff;
}

/* ===== Checkbox ===== */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.checkbox-group label {
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn-secondary:hover {
    background: #fff;
    border-color: var(--primary);
    color: var(--primary);
}

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

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

.btn-lg {
    padding: 14px 32px;
    font-size: 15px;
    border-radius: var(--radius);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-generate {
    background: linear-gradient(135deg, var(--primary) 0%, #3b82f6 100%);
    color: #fff;
    padding: 14px 32px;
    font-size: 15px;
    border-radius: var(--radius);
    box-shadow: 0 4px 14px rgba(26, 86, 219, 0.4);
}

.btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26, 86, 219, 0.5);
}

/* ===== Article Generation Layout ===== */
.create-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
    align-items: start;
}

.create-sidebar {
    position: sticky;
    top: 32px;
}

/* ===== Image Options Card ===== */
.image-options {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}

.image-options h4 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.images-count {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-light);
}

.images-count input {
    width: 50px;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    text-align: center;
}

/* ===== Tip Box ===== */
.tip-box {
    background: var(--primary-light);
    border: 1px solid rgba(26, 86, 219, 0.2);
    border-radius: var(--radius);
    padding: 16px;
    font-size: 13px;
    color: var(--primary-dark);
    line-height: 1.5;
}

.tip-box strong {
    display: block;
    margin-bottom: 4px;
}

/* ===== Article Library ===== */
.articles-list {
    display: grid;
    gap: 16px;
}

.article-item {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.article-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.article-item-info h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.article-item-meta {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--text-light);
}

.article-item-actions {
    display: flex;
    gap: 8px;
}

/* ===== Article Preview ===== */
.article-preview {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    max-width: 800px;
    margin: 0 auto;
}

.article-preview h1 {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 16px;
    line-height: 1.3;
}

.article-preview img {
    width: 100%;
    border-radius: var(--radius);
    margin-bottom: 24px;
}

.article-preview h2 {
    font-size: 22px;
    font-weight: 700;
    margin: 24px 0 12px;
}

.article-preview h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 20px 0 10px;
}

.article-preview p {
    margin-bottom: 16px;
    line-height: 1.8;
    color: #374151;
}

.article-preview ul,
.article-preview ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

.article-preview li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.article-preview strong {
    color: var(--text);
}

/* ===== Search Bar ===== */
.search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 24px;
}

.search-bar .icon {
    color: var(--text-light);
    font-size: 18px;
}

.search-bar input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
}

.search-bar input::placeholder {
    color: #94a3b8;
}

/* ===== Image Lightbox ===== */
.lightbox-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}

.lightbox-overlay.active {
    display: flex;
}

.lightbox-img {
    max-width: 95%;
    max-height: 90vh;
    border-radius: 8px;
    object-fit: contain;
    animation: lightboxIn 0.2s ease;
}

@keyframes lightboxIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    color: #fff;
    font-size: 36px;
    cursor: pointer;
    z-index: 100000;
    line-height: 1;
    padding: 8px;
}

.article-preview img,
.article-body img {
    cursor: zoom-in;
    transition: opacity 0.2s;
}

.article-preview img:hover,
.article-body img:hover {
    opacity: 0.85;
}

/* ===== Loading Overlay ===== */
.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(6px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.loading-overlay.active {
    display: flex;
}

.loading-modal {
    background: #fff;
    border-radius: 20px;
    padding: 48px 56px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    max-width: 440px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    animation: modalIn 0.3s ease;
}

@media (max-width: 768px) {
    .loading-modal {
        padding: 28px 24px;
        border-radius: 16px;
        width: 92%;
        max-height: 80vh;
    }

    .loading-circle-container {
        width: 80px;
        height: 80px;
        margin-bottom: 16px;
    }

    .loading-circle {
        width: 80px;
        height: 80px;
    }

    .loading-percentage {
        font-size: 18px;
    }

    .loading-title {
        font-size: 15px;
        margin-bottom: 4px;
    }

    .loading-subtitle {
        font-size: 12px;
        margin-bottom: 16px;
    }

    .progress-step {
        padding: 6px 0;
        gap: 10px;
    }

    .step-label {
        font-size: 12px;
    }

    .step-dot {
        width: 16px;
        height: 16px;
        min-width: 16px;
    }
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Circle progress */
.loading-circle-container {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 24px;
}

.loading-circle {
    width: 100px;
    height: 100px;
    transform: rotate(-90deg);
}

.loading-circle-bg {
    fill: none;
    stroke: #e2e8f0;
    stroke-width: 6;
}

.loading-circle-progress {
    fill: none;
    stroke: var(--primary);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 263.89;
    stroke-dashoffset: 263.89;
    transition: stroke-dashoffset 0.3s ease;
}

.loading-percentage {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
}

.loading-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}

.loading-subtitle {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 24px;
}

/* Progress bar */
.progress-bar-container {
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 24px;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), #3b82f6);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* Progress steps */
.progress-steps {
    text-align: left;
}

.progress-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    opacity: 0.4;
    transition: all 0.3s ease;
}

.progress-step.active {
    opacity: 1;
}

.progress-step.completed .step-dot {
    background: var(--success);
    border-color: var(--success);
}

.progress-step.completed .step-dot::after {
    content: '✓';
    color: #fff;
    font-size: 9px;
    font-weight: 700;
}

.step-dot {
    width: 20px;
    height: 20px;
    min-width: 20px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.progress-step.active:not(.completed) .step-dot {
    border-color: var(--primary);
    background: var(--primary-light);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(26, 86, 219, 0.3); }
    50% { box-shadow: 0 0 0 6px rgba(26, 86, 219, 0); }
}

.step-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}

.progress-step:not(.active) .step-label {
    color: var(--text-light);
}

/* ===== Login Page ===== */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
}

.auth-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.auth-card h2 {
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
}

.auth-card p {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 24px;
    font-size: 14px;
}

.auth-card .form-group {
    margin-bottom: 16px;
}

.auth-card .btn {
    width: 100%;
    margin-top: 8px;
}

.auth-footer {
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-light);
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

/* ===== History Table ===== */
.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.history-table thead tr {
    border-bottom: 1px solid var(--border);
}

.history-table th {
    text-align: left;
    padding: 10px 16px;
    font-weight: 600;
    color: var(--text-light);
    font-size: 11px;
    text-transform: uppercase;
}

.history-table th:nth-child(2),
.history-table th:nth-child(3) {
    text-align: center;
}

.history-table th:nth-child(4),
.history-table th:nth-child(5) {
    text-align: right;
}

.history-table tbody tr {
    border-bottom: 1px solid var(--border);
}

.history-table td {
    padding: 10px 16px;
}

.history-table td:first-child {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-table td:nth-child(2),
.history-table td:nth-child(3) {
    text-align: center;
}

.history-table td:nth-child(4) {
    text-align: right;
    font-weight: 600;
    color: var(--danger);
}

.history-table td:nth-child(5) {
    text-align: right;
    color: var(--text-light);
}

/* ===== Alerts ===== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-info {
    background: var(--primary-light);
    color: var(--primary-dark);
    border: 1px solid rgba(26, 86, 219, 0.2);
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .create-layout {
        grid-template-columns: 1fr;
    }
    .create-sidebar {
        position: static;
    }
    .credits-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===== Mobile Hamburger Menu ===== */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1100;
    background: var(--sidebar-bg);
    border: none;
    border-radius: 8px;
    width: 42px;
    height: 42px;
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 10px;
    box-shadow: var(--shadow-md);
}

.mobile-menu-btn .hamburger-line {
    display: block;
    width: 22px;
    height: 2.5px;
    background: #fff;
    border-radius: 2px;
    transition: transform 0.3s, opacity 0.3s;
}

.mobile-menu-btn.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.sidebar-overlay.active {
    display: block;
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
        z-index: 1000;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-brand {
        padding-left: 44px;
    }

    .main-content {
        margin-left: 0;
        padding: 70px 16px 24px;
        width: 100%;
        min-width: 0;
    }

    .top-bar {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    .credits-badge {
        font-size: 12px;
        padding: 6px 12px;
    }

    .page-header h2 {
        font-size: 24px;
    }

    .page-header p {
        font-size: 13px;
    }

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

    .stat-card {
        padding: 14px;
    }

    .stat-value {
        font-size: 20px;
    }

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

    .create-layout {
        grid-template-columns: 1fr;
    }

    .create-sidebar {
        position: static;
    }

    .tabs {
        flex-wrap: wrap;
        gap: 4px;
    }

    .tab-btn {
        font-size: 12px;
        padding: 8px 12px;
    }

    .credits-grid {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }

    .article-preview img {
        max-width: 100%;
        height: auto;
    }

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

    /* Credits page */
    .credit-plan {
        padding: 20px;
    }

    .plan-credits {
        font-size: 28px;
    }

    .plan-price {
        font-size: 22px;
    }

    /* Tables responsive */
    .history-table-wrap {
        padding: 0 16px;
    }

    .history-table thead {
        display: none;
    }

    .history-table tbody tr {
        display: block;
        padding: 14px 0;
        border-bottom: 1px solid var(--border);
    }

    .history-table tbody tr:last-child {
        border-bottom: none;
    }

    .history-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 4px 0;
        font-size: 13px;
        text-align: right;
        white-space: normal;
        max-width: none;
        border: none;
    }

    .history-table tbody td::before {
        content: attr(data-label);
        font-weight: 500;
        color: var(--text-light);
        text-align: left;
        font-size: 12px;
        flex-shrink: 0;
        margin-right: 12px;
    }

    .history-table tbody td:first-child {
        font-weight: 600;
        font-size: 14px;
        margin-bottom: 4px;
    }

    .history-table tbody td:first-child::before {
        display: none;
    }

    .history-table tbody td.cost-cell {
        color: var(--danger);
        font-weight: 600;
    }

    /* WordPress page */
    .wp-form .form-grid {
        grid-template-columns: 1fr;
    }

    /* General text overflow prevention */
    .main-content {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .main-content p,
    .main-content h2,
    .main-content h3 {
        overflow-wrap: break-word;
        word-break: break-word;
    }

    /* Preview page responsive */
    .article-meta {
        flex-wrap: wrap !important;
    }

    /* Library items */
    .article-item {
        padding: 16px;
    }

    .article-item-title {
        font-size: 14px;
    }
}

/* ===== Credits Page ===== */
.credits-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 24px;
}

.credit-plan {
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
}

.credit-plan:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.credit-plan.popular::before {
    content: 'Popular';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: #fff;
    padding: 2px 12px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.credit-plan h4 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
}

.credit-plan .plan-credits {
    font-size: 36px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 4px;
}

.credit-plan .plan-price {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 16px;
}

.credit-plan ul {
    list-style: none;
    text-align: left;
    font-size: 13px;
    color: var(--text-light);
}

.credit-plan ul li {
    padding: 4px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.credit-plan ul li::before {
    content: '✓';
    color: var(--success);
    font-weight: 700;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    margin-bottom: 20px;
}





.step-label {
    flex: 1;
}


/* ===== Toggle Switch ===== */
.toggle-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toggle-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--border);
    border-radius: 24px;
    transition: 0.3s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--primary);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}


/* Fix select dropdown height */
.form-select {
    overflow-y: auto;
}

select.form-select option {
    padding: 8px 12px;
}


/* ===== Progress Steps Animation ===== */
.progress-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    opacity: 0.35;
    transition: all 0.4s ease;
}

.progress-step.active {
    opacity: 1;
}

.progress-step.completed {
    opacity: 0.7;
}

.step-indicator {
    position: relative;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-step .step-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border);
    transition: all 0.3s;
}

.progress-step.active .step-dot {
    background: var(--primary);
    box-shadow: 0 0 0 4px rgba(26, 86, 219, 0.15);
}

.progress-step.completed .step-dot {
    background: var(--success);
    width: 12px;
    height: 12px;
}

.progress-step.completed .step-dot::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 8px;
    font-weight: 700;
}

/* Working animation (typing indicator) */
.step-working {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.progress-step.active .step-working {
    display: flex;
    gap: 2px;
    align-items: center;
}

.progress-step.active .step-dot {
    display: none;
}

.progress-step.active .step-working::before,
.progress-step.active .step-working::after,
.progress-step.active .step-working span {
    display: none;
}

/* Pulse animation for active step dot replacement */
.progress-step.active .step-indicator::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--primary);
    border-radius: 50%;
    animation: pulse-dot 1.2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.6); opacity: 0.4; }
}

.progress-step.completed .step-indicator::after {
    display: none;
}

.progress-step .step-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-light);
}

.progress-step.active .step-label {
    color: var(--text);
    font-weight: 600;
}

.progress-step.completed .step-label {
    color: var(--success);
    text-decoration: line-through;
    text-decoration-color: rgba(16, 185, 129, 0.4);
}
