/* ==========================================================
   PRIMEFORGE AI - PREMIUM SaaS UI
   Part 1
========================================================== */

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

/* ==========================================================
   RESET
========================================================== */

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

html {
    scroll-behavior: smooth;
}

body {

    font-family: 'Inter', sans-serif;

    background:
        radial-gradient(circle at top, #172554 0%, #0B1120 45%, #050816 100%);

    color: #F8FAFC;

    overflow: hidden;

}

/* ==========================================================
   VARIABLES
========================================================== */

:root {

    --bg: #0B1120;

    --surface: rgba(20, 28, 45, .72);

    --surface2: #182235;

    --primary: #4F8CFF;

    --primaryHover: #6EA8FF;

    --accent: #22D3EE;

    --text: #F8FAFC;

    --muted: #94A3B8;

    --border: rgba(255, 255, 255, .08);

    --success: #22C55E;

    --danger: #EF4444;

    --shadow:
        0 10px 40px rgba(0, 0, 0, .35);

}

/* ==========================================================
   APP LAYOUT
========================================================== */

.app-container {

    display: flex;

    width: 100%;

    height: 100vh;

}

/* ==========================================================
   SIDEBAR
========================================================== */

.sidebar {

    width: 285px;

    background: var(--surface);

    backdrop-filter: blur(18px);

    border-right: 1px solid var(--border);

    padding: 30px;

    display: flex;

    flex-direction: column;

}

.logo {

    margin-bottom: 40px;

}

.logo h2 {

    font-size: 28px;

    font-weight: 800;

    letter-spacing: -1px;

}

.logo span {

    color: var(--accent);

}

.logo p {

    margin-top: 10px;

    color: var(--muted);

    font-size: 14px;

}

.nav-tabs {

    display: flex;

    flex-direction: column;

    gap: 12px;

}

.tab-btn {

    display: flex;

    align-items: center;

    gap: 14px;

    width: 100%;

    padding: 15px;

    background: transparent;

    border: none;

    color: var(--muted);

    border-radius: 14px;

    cursor: pointer;

    transition: .35s;

    font-size: 15px;

    font-weight: 600;

}

.tab-btn:hover {

    background: rgba(79, 140, 255, .12);

    color: white;

    transform: translateX(6px);

}

.tab-btn.active {

    background: linear-gradient(135deg,
            rgba(79, 140, 255, .18),
            rgba(34, 211, 238, .10));

    color: white;

    border: 1px solid rgba(79, 140, 255, .25);
}

/* =====================================================
   APP LAYOUT
===================================================== */

.app-container {

    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;

}

/* =====================================================
   SIDEBAR
===================================================== */

.sidebar {

    width: 280px;
    height: 100vh;

    background: var(--sidebar-bg);

    border-right: 1px solid var(--border-color);

    display: flex;
    flex-direction: column;

    padding: 28px 20px;

    overflow-y: auto;
    overflow-x: hidden;

    transition:
        width .35s ease,
        padding .35s ease;

    scrollbar-width: none;
    -ms-overflow-style: none;

}

.sidebar::-webkit-scrollbar {

    display: none;

}

/* =====================================================
   COLLAPSED SIDEBAR
===================================================== */

.sidebar.collapsed {

    width: 88px;

}

/* Hide only text */

.sidebar.collapsed .logo span,
.sidebar.collapsed .logo p,
.sidebar.collapsed .tab-btn span,
.sidebar.collapsed .recent-history,
.sidebar.collapsed .sidebar-divider,
.sidebar.collapsed .sidebar-footer {

    display: none;

}

/* Center everything */

.sidebar.collapsed .logo {

    display: flex;
    justify-content: center;
    align-items: center;

}

.sidebar.collapsed .logo h2 {

    font-size: 28px;

}

.sidebar.collapsed .tab-btn {

    justify-content: center;

    padding: 15px;

}

.sidebar.collapsed .tab-btn i {

    margin: 0;

}

/* =====================================================
   LOGO
===================================================== */

.logo {

    margin-bottom: 28px;

}

.logo h2 {

    display: flex;
    align-items: center;
    gap: 10px;

    font-size: 25px;
    font-weight: 700;

}

.logo span {

    color: var(--accent-color);

}

.logo p {

    margin-top: 10px;

    color: var(--text-muted);

    font-size: 14px;

}

/* =====================================================
   NAVIGATION
===================================================== */

.nav-tabs {

    display: flex;
    flex-direction: column;
    gap: 12px;

}

.tab-btn {

    display: flex;
    align-items: center;
    gap: 14px;

    width: 100%;

    padding: 14px 16px;

    background: transparent;

    border: none;

    border-radius: 14px;

    color: var(--text-muted);

    cursor: pointer;

    transition: all .25s ease;

    font-size: 15px;

    text-align: left;

}

.tab-btn i {

    width: 20px;
    text-align: center;

}

.tab-btn:hover {

    background: rgba(255, 255, 255, .05);

    color: white;

    transform: translateX(4px);

}

.tab-btn.active {

    background: var(--accent-color);

    color: white;

}

/* =====================================================
   DIVIDER
===================================================== */

.sidebar-divider {

    margin: 28px 0;

    height: 1px;

    background: var(--border-color);

}

/* =====================================================
   RECENT PROJECTS
===================================================== */

.recent-history {

    margin-bottom: 25px;

}

.recent-history h4 {

    color: white;

    font-size: 15px;

    margin-bottom: 18px;

}

.recent-history ul {

    list-style: none;

    padding: 0;

    margin: 0;

}

.recent-history li {

    padding: 12px;

    border-radius: 12px;

    margin-bottom: 8px;

    color: var(--text-muted);

    cursor: pointer;

    transition: all .25s ease;

}

.recent-history li:hover {

    background: rgba(255, 255, 255, .05);

    color: white;

    transform: translateX(3px);

}

/* =====================================================
   FOOTER
===================================================== */

.sidebar-footer {

    margin-top: auto;

    padding-top: 22px;

    border-top: 1px solid rgba(255, 255, 255, .08);

    text-align: center;

}

.sidebar-footer small {

    display: block;

    line-height: 1.8;

    color: rgba(255, 255, 255, .45);

    font-size: 12px;

}

.logout-btn {

    width: 100%;

    padding: 14px;

    margin-top: 30px;

    background: #ef4444;

    color: white;

    border: none;

    border-radius: 12px;

    cursor: pointer;

    font-weight: 600;

    transition: .3s;

}

.logout-btn:hover {

    background: #dc2626;

}

/* =====================================================
   MAIN CONTENT
===================================================== */

.main-content {

    flex: 1;

    overflow-y: auto;

    transition: all .35s ease;

}

/* =====================================================
   SIDEBAR TOGGLE BUTTON
===================================================== */

.sidebar {

    position: fixed;

    top: 0;
    left: 0;

    width: 280px;

    height: 100vh;

    background: var(--sidebar-bg);

    display: flex;

    flex-direction: column;

    padding: 25px;

    z-index: 1000;

}

.sidebar.collapsed {

    transform: translateX(-100%);

}

.sidebar-toggle:hover {

    background: var(--accent-color);

    transform: scale(1.06);

}

.sidebar-toggle {

    position: fixed;

    top: 18px;

    left: 300px;

    width: 42px;
    height: 42px;

    border: none;

    border-radius: 10px;

    cursor: pointer;

    z-index: 2000;

    transition: .35s;

}

.sidebar.collapsed+.main-content .sidebar-toggle {

    left: 20px;

}

/* ==========================================================
   MAIN CONTENT
========================================================== */

.main-content {

    margin-left: 280px;

    width: calc(100% - 280px);

    transition: .35s;

}

.main-content.expanded {

    margin-left: 0;

}

/* Scrollbar */

.main-content::-webkit-scrollbar {

    width: 10px;

}

.main-content::-webkit-scrollbar-thumb {

    background: #2A3958;

    border-radius: 20px;

}

/* ==========================================================
   HERO
========================================================== */

.hero {

    margin-bottom: 35px;

}

.hero h1 {

    font-size: 44px;

    font-weight: 800;

    line-height: 1.1;

    letter-spacing: -2px;

}

.hero p {

    margin-top: 15px;

    color: var(--muted);

    font-size: 18px;

    max-width: 720px;

    line-height: 1.7;

}

.hero-badges {

    display: flex;

    gap: 12px;

    flex-wrap: wrap;

    margin-top: 28px;

}

.hero-badges span {

    background: rgba(255, 255, 255, .05);

    border: 1px solid var(--border);

    padding: 10px 18px;

    border-radius: 50px;

    color: #CBD5E1;

    font-size: 14px;

}

/* ==========================================================
   STATS
========================================================== */

.stats-grid {

    display: grid;

    grid-template-columns: repeat(3, 1fr);

    gap: 20px;

    margin-bottom: 35px;

}

.stat-card {

    background: var(--surface);

    backdrop-filter: blur(15px);

    border: 1px solid var(--border);

    border-radius: 22px;

    padding: 28px;

    transition: .35s;

    box-shadow: var(--shadow);

}

.stat-card:hover {

    transform: translateY(-8px);

    border-color: rgba(79, 140, 255, .35);

}

.stat-card h2 {

    font-size: 34px;

    color: var(--primary);

}

.stat-card p {

    margin-top: 8px;

    color: var(--muted);

}

/* ==========================================================
   CONTENT CARD
========================================================== */

.tab-content {

    background: var(--surface);

    backdrop-filter: blur(15px);

    border: 1px solid var(--border);

    border-radius: 24px;

    padding: 35px;

    box-shadow: var(--shadow);

    margin-bottom: 35px;

}

.tool-header {

    margin-bottom: 28px;

}

.tool-header h2 {

    font-size: 28px;

    margin-bottom: 10px;

}

.tool-header p {

    color: var(--muted);

    line-height: 1.7;

}

/* ==========================================================
   FORM GRID
========================================================== */

.form-grid {

    display: grid;

    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));

    gap: 22px;

    margin-bottom: 25px;

}

.input-group {

    display: flex;

    flex-direction: column;

    margin-bottom: 22px;

}

.input-group label {

    display: flex;

    align-items: center;

    gap: 10px;

    margin-bottom: 10px;

    color: #E2E8F0;

    font-size: 14px;

    font-weight: 600;

}

.input-group label i {

    color: var(--primary);

}

/* ==========================================================
   INPUTS
========================================================== */

.input-group input,
.input-group textarea,
.input-group select {

    width: 100%;

    background: rgba(255, 255, 255, .03);

    border: 1px solid var(--border);

    color: var(--text);

    padding: 16px 18px;

    border-radius: 16px;

    font-size: 15px;

    font-family: 'Inter', sans-serif;

    transition: .3s;

    outline: none;

}

.input-group textarea {

    resize: none;

    min-height: 160px;

    line-height: 1.7;

}

.input-group input::placeholder,
.input-group textarea::placeholder {

    color: #64748B;

}

.input-group select {

    cursor: pointer;

}

.input-group input:hover,
.input-group textarea:hover,
.input-group select:hover {

    border-color: rgba(79, 140, 255, .25);

}

.input-group input:focus,
.input-group textarea:focus,
.input-group select:focus {

    border-color: var(--primary);

    box-shadow:
        0 0 0 4px rgba(79, 140, 255, .12);

    background: rgba(255, 255, 255, .05);

}

/* ==========================================================
   CHARACTER COUNTER
========================================================== */

.char-counter {

    display: flex;

    justify-content: flex-end;

    margin-top: 8px;

    color: var(--muted);

    font-size: 13px;

}

/* ==========================================================
   BUTTON AREA
========================================================== */

.action-buttons {

    display: flex;

    gap: 15px;

    margin-top: 25px;

    flex-wrap: wrap;

}

/* ==========================================================
   PRIMARY BUTTON
========================================================== */

.generate-btn {

    display: flex;

    align-items: center;

    justify-content: center;

    gap: 10px;

    border: none;

    cursor: pointer;

    padding: 16px 30px;

    border-radius: 16px;

    font-size: 15px;

    font-weight: 700;

    color: white;

    background:

        linear-gradient(135deg,
            var(--primary),
            #2563EB);

    transition: .35s;

    box-shadow:

        0 10px 25px rgba(37, 99, 235, .35);

}

.generate-btn:hover {

    transform: translateY(-4px);

    box-shadow:

        0 18px 40px rgba(37, 99, 235, .45);

}

.generate-btn:active {

    transform: scale(.97);

}

/* ==========================================================
   CLEAR BUTTON
========================================================== */

.clear-btn {

    display: flex;

    align-items: center;

    justify-content: center;

    gap: 10px;

    padding: 16px 28px;

    background: transparent;

    color: #CBD5E1;

    border: 1px solid var(--border);

    border-radius: 16px;

    cursor: pointer;

    font-weight: 600;

    transition: .3s;

}

.clear-btn:hover {

    background: #EF4444;

    color: white;

    border-color: #EF4444;

}

/* ==========================================================
   SECONDARY BUTTONS
========================================================== */

.secondary-btn,
.copy-btn {

    display: flex;

    align-items: center;

    gap: 8px;

    padding: 12px 18px;

    background: rgba(255, 255, 255, .04);

    color: white;

    border: 1px solid var(--border);

    border-radius: 12px;

    cursor: pointer;

    font-size: 14px;

    font-weight: 600;

    transition: .3s;

}

.secondary-btn:hover,
.copy-btn:hover {

    background: rgba(79, 140, 255, .12);

    border-color: rgba(79, 140, 255, .30);

    transform: translateY(-2px);

}

/* ==========================================================
   SMALL ICON ANIMATION
========================================================== */

.generate-btn i,
.clear-btn i,
.secondary-btn i,
.copy-btn i {

    transition: .3s;

}

.generate-btn:hover i {

    transform: rotate(-18deg);

}

.secondary-btn:hover i,
.copy-btn:hover i {

    transform: scale(1.15);

}

/* ==========================================================
   OUTPUT CONTAINER
========================================================== */

.output-container {

    background: var(--surface);

    backdrop-filter: blur(18px);

    border: 1px solid var(--border);

    border-radius: 24px;

    padding: 28px;

    box-shadow: var(--shadow);

    margin-bottom: 40px;

}

.output-header {

    display: flex;

    justify-content: space-between;

    align-items: center;

    flex-wrap: wrap;

    gap: 20px;

    margin-bottom: 25px;

}

.output-header h3 {

    font-size: 26px;

    margin-bottom: 5px;

}

.output-header small {

    color: var(--muted);

}

.output-actions {

    display: flex;

    gap: 12px;

    flex-wrap: wrap;

}

/* ==========================================================
   OUTPUT BOX
========================================================== */

.output-box {

    min-height: 260px;

    background: rgba(255, 255, 255, .025);

    border: 1px dashed rgba(255, 255, 255, .10);

    border-radius: 18px;

    padding: 30px;

    font-size: 16px;

    line-height: 1.9;

    color: #E2E8F0;

    transition: .35s;

}

.output-box:hover {

    border-color: rgba(79, 140, 255, .25);

}

/* ==========================================================
   EMPTY STATE
========================================================== */

.empty-state {

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    text-align: center;

    min-height: 200px;

}

.empty-state i {

    font-size: 60px;

    color: var(--primary);

    margin-bottom: 20px;

}

.empty-state h3 {

    font-size: 26px;

    margin-bottom: 12px;

}

.empty-state p {

    max-width: 500px;

    color: var(--muted);

    line-height: 1.8;

}

/* ==========================================================
   QUALITY BADGES
========================================================== */

.quality-badges {

    display: flex;

    gap: 12px;

    flex-wrap: wrap;

    margin-top: 25px;

}

.quality-badges span {

    background: rgba(34, 197, 94, .08);

    border: 1px solid rgba(34, 197, 94, .18);

    color: #86EFAC;

    padding: 10px 16px;

    border-radius: 30px;

    font-size: 13px;

    font-weight: 600;

}

/* ==========================================================
   KEYBOARD SHORTCUT
========================================================== */

.keyboard-shortcut {

    text-align: center;

    color: var(--muted);

    margin-top: 25px;

    font-size: 14px;

}

/* ==========================================================
   LOADING OVERLAY
========================================================== */

.loading-overlay {

    position: fixed;

    inset: 0;

    display: none;

    justify-content: center;

    align-items: center;

    background: rgba(4, 10, 20, .82);

    backdrop-filter: blur(10px);

    z-index: 9999;

}

.loader-card {

    width: 420px;

    background: var(--surface2);

    border: 1px solid var(--border);

    border-radius: 24px;

    padding: 40px;

    text-align: center;

    box-shadow: 0 20px 60px rgba(0, 0, 0, .45);

}

.loader-icon {

    width: 80px;

    height: 80px;

    border-radius: 50%;

    background: linear-gradient(135deg, var(--primary), var(--accent));

    display: flex;

    justify-content: center;

    align-items: center;

    margin: auto;

    margin-bottom: 25px;

    animation: spinHammer 2s linear infinite;

}

.loader-icon i {

    font-size: 34px;

    color: white;

}

.loader-card h2 {

    margin-bottom: 12px;

}

.loader-card p {

    color: var(--muted);

}

.progress-bar {

    margin-top: 30px;

    width: 100%;

    height: 10px;

    background: #24324B;

    border-radius: 30px;

    overflow: hidden;

}

.progress-fill {

    width: 35%;

    height: 100%;

    background: linear-gradient(90deg, var(--primary), var(--accent));

    animation: loadingBar 2s infinite;

}

/* ==========================================================
   TOAST
========================================================== */

.toast {

    position: fixed;

    right: 30px;

    bottom: 30px;

    background: #16A34A;

    color: white;

    padding: 16px 24px;

    border-radius: 16px;

    display: flex;

    gap: 12px;

    align-items: center;

    transform: translateY(120px);

    opacity: 0;

    transition: .4s;

    box-shadow: 0 15px 40px rgba(0, 0, 0, .35);

    z-index: 99999;

}

.toast.show {

    transform: translateY(0);

    opacity: 1;

}

/* ==========================================================
   FOOTER
========================================================== */

.footer {

    text-align: center;

    padding: 25px;

    color: var(--muted);

    font-size: 14px;

}

/* ==========================================================
   ANIMATIONS
========================================================== */

@keyframes loadingBar {

    0% {

        width: 0%;

    }

    50% {

        width: 75%;

    }

    100% {

        width: 100%;

    }

}

@keyframes spinHammer {

    0% {

        transform: rotate(0deg);

    }

    50% {

        transform: rotate(180deg);

    }

    100% {

        transform: rotate(360deg);

    }

}

@keyframes fadeUp {

    from {

        opacity: 0;

        transform: translateY(25px);

    }

    to {

        opacity: 1;

        transform: translateY(0);

    }

}

.hero,
.stats-grid,
.tab-content,
.output-container {

    animation: fadeUp .7s ease;

}

/* ==========================================================
   RESPONSIVE
========================================================== */

@media(max-width:1100px) {

    .stats-grid {

        grid-template-columns: 1fr;

    }

    .form-grid {

        grid-template-columns: 1fr;

    }

}

@media(max-width:900px) {

    .app-container {

        flex-direction: column;

        height: auto;

    }

    .sidebar {

        width: 100%;

    }

    .main-content {

        padding: 25px;

    }

    .hero h1 {

        font-size: 34px;

    }

    .output-header {

        flex-direction: column;

        align-items: flex-start;

    }

    .loader-card {

        width: 90%;

    }

}

@media(max-width:600px) {

    .hero h1 {

        font-size: 28px;

    }

    .generate-btn,
    .clear-btn,
    .secondary-btn,
    .copy-btn {

        width: 100%;

        justify-content: center;

    }

    .action-buttons {

        flex-direction: column;

    }

    .output-actions {

        width: 100%;

        flex-direction: column;

    }

    .hero-badges {

        justify-content: center;

    }

}

/* Target your specific AI Result box container */
.generated-output,
#ai-result-box {
    white-space: pre-wrap;
    /*  CRITICAL: This honors line breaks and paragraphs sent by the AI */
    word-wrap: break-word;
    /* Prevents long text or links from running off the screen */
    line-height: 1.6;
    /* Gives the typography professional, readable breathing room */
    color: #E2E8F0;
    /* Clean, crisp off-white for high-end dark mode readability */
    font-size: 0.95rem;
}

/* Ensure paragraph spacings render if the AI returns them */
.generated-output p {
    margin-bottom: 1rem;
}

.generated-output p:last-child {
    margin-bottom: 0;
}

/* Style the bold headers the AI gives you */
.generated-output strong,
.generated-output h3 {
    color: #A78BFA;
    /* Vibrant light-purple accent for titles */
    display: inline-block;
    margin-top: 0.5rem;
    margin-bottom: 0.25rem;
}

.pro-badge {

    margin-left: 10px;

    background: #7C3AED;

    color: white;

    font-size: 10px;

    font-weight: 700;

    padding: 3px 8px;

    border-radius: 30px;

}

.sidebar nav a {

    display: flex;

    justify-content: space-between;

    align-items: center;

}