/* ============================================================
   AI Diginest — main stylesheet
   Light mode default; dark mode via [data-bs-theme="dark"]
   ============================================================ */

:root {
    --aidg-primary:    #5b6cff;
    --aidg-primary-2:  #7a3ff0;
    --aidg-accent:     #20c997;
    --aidg-bg:         #f6f7fb;
    --aidg-card:       #ffffff;
    --aidg-text:       #0f172a;
    --aidg-muted:      #64748b;
    --aidg-border:     #e5e7eb;
    --aidg-soft:       #eef0f7;
    --aidg-shadow:     0 10px 30px rgba(15, 23, 42, 0.06);
    --aidg-shadow-lg:  0 20px 60px rgba(15, 23, 42, 0.10);
    --aidg-radius:     14px;
    --aidg-mono:       ui-monospace, SFMono-Regular, Menlo, Monaco, "JetBrains Mono", monospace;
}

[data-bs-theme="dark"] {
    --aidg-primary:   #7a8bff;
    --aidg-primary-2: #a578ff;
    --aidg-accent:    #2dd4bf;
    --aidg-bg:        #0b1020;
    --aidg-card:      #121933;
    --aidg-text:      #e6e9f5;
    --aidg-muted:     #9aa3bf;
    --aidg-border:    #1f274a;
    --aidg-soft:      #182046;
    --aidg-shadow:    0 10px 30px rgba(0, 0, 0, 0.35);
    --aidg-shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }

html, body {
    height: 100%;
}

body {
    background: var(--aidg-bg);
    color: var(--aidg-text);
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.2s ease, color 0.2s ease;
}

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

/* ----- Navbar ----- */
.aidg-navbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: color-mix(in srgb, var(--aidg-card) 92%, transparent);
    backdrop-filter: saturate(160%) blur(10px);
    border-bottom: 1px solid var(--aidg-border);
}
.aidg-navbar .navbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    color: var(--aidg-text);
}
.aidg-logo {
    width: 36px; height: 36px; border-radius: 10px;
    background: linear-gradient(135deg, var(--aidg-primary), var(--aidg-primary-2));
    color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 1.05rem;
    box-shadow: 0 6px 16px rgba(91, 108, 255, 0.35);
}
.aidg-nav-link {
    color: var(--aidg-text) !important;
    font-weight: 500;
    padding: 0.5rem 0.9rem !important;
    border-radius: 8px;
}
.aidg-nav-link:hover { background: var(--aidg-soft); }

/* ----- Hero ----- */
.aidg-hero {
    position: relative;
    padding: 5rem 0 3rem;
    text-align: center;
    overflow: hidden;
}
.aidg-hero::before {
    content: "";
    position: absolute; inset: -20% -10% auto -10%;
    height: 360px;
    background: radial-gradient(closest-side, rgba(91,108,255,0.20), transparent 70%);
    z-index: 0;
}
.aidg-hero h1 {
    font-size: clamp(2.2rem, 4.5vw, 3.6rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--aidg-primary), var(--aidg-primary-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin: 0 0 0.75rem;
    position: relative;
}
.aidg-hero p.lead {
    color: var(--aidg-muted);
    max-width: 720px;
    margin: 0 auto;
    font-size: 1.1rem;
    position: relative;
}
.aidg-hero .aidg-badges {
    margin-top: 1.4rem;
    display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap;
    position: relative;
}
.aidg-hero .aidg-badge {
    background: var(--aidg-soft);
    color: var(--aidg-text);
    border: 1px solid var(--aidg-border);
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 500;
}

/* ----- Card ----- */
.aidg-card {
    background: var(--aidg-card);
    border: 1px solid var(--aidg-border);
    border-radius: var(--aidg-radius);
    box-shadow: var(--aidg-shadow);
    padding: 1.5rem;
    position: relative;
}

/* ----- Tool selector ----- */
.aidg-tools {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.6rem;
}
.aidg-tool {
    background: var(--aidg-card);
    border: 1px solid var(--aidg-border);
    border-radius: 12px;
    padding: 0.85rem 0.8rem;
    cursor: pointer;
    display: flex; flex-direction: column; align-items: flex-start; gap: 0.35rem;
    color: var(--aidg-text);
    transition: all 0.15s ease;
    text-align: left;
    font: inherit;
}
.aidg-tool:hover { transform: translateY(-1px); border-color: var(--aidg-primary); }
.aidg-tool.active {
    border-color: var(--aidg-primary);
    background: linear-gradient(180deg, color-mix(in srgb, var(--aidg-primary) 12%, transparent), transparent);
    box-shadow: 0 6px 18px color-mix(in srgb, var(--aidg-primary) 25%, transparent);
}
.aidg-tool i { font-size: 1.2rem; color: var(--aidg-primary); }
.aidg-tool .label { font-weight: 600; font-size: 0.95rem; }
.aidg-tool .desc  { font-size: 0.78rem; color: var(--aidg-muted); line-height: 1.2; }

/* ----- Editor (textarea) ----- */
.aidg-editor {
    width: 100%;
    min-height: 240px;
    border-radius: 12px;
    border: 1px solid var(--aidg-border);
    background: var(--aidg-card);
    color: var(--aidg-text);
    padding: 1rem 1.1rem;
    font: 0.95rem/1.55 "Inter", system-ui, sans-serif;
    resize: vertical;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.aidg-editor:focus {
    outline: none;
    border-color: var(--aidg-primary);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--aidg-primary) 15%, transparent);
}
.aidg-editor[readonly] { background: var(--aidg-soft); }

.aidg-stats {
    display: flex; gap: 1rem; flex-wrap: wrap;
    font-size: 0.83rem; color: var(--aidg-muted);
    margin-top: 0.4rem;
}
.aidg-stats strong { color: var(--aidg-text); font-weight: 600; }

/* ----- Buttons ----- */
.aidg-btn {
    display: inline-flex; align-items: center; gap: 0.4rem;
    border-radius: 10px;
    padding: 0.55rem 1rem;
    font-weight: 600;
    font-size: 0.92rem;
    border: 1px solid var(--aidg-border);
    background: var(--aidg-card);
    color: var(--aidg-text);
    cursor: pointer;
    transition: all 0.15s ease;
}
.aidg-btn:hover { border-color: var(--aidg-primary); color: var(--aidg-primary); }
.aidg-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.aidg-btn-primary {
    background: linear-gradient(135deg, var(--aidg-primary), var(--aidg-primary-2));
    border: none;
    color: #fff;
    box-shadow: 0 6px 18px color-mix(in srgb, var(--aidg-primary) 35%, transparent);
}
.aidg-btn-primary:hover {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 10px 24px color-mix(in srgb, var(--aidg-primary) 45%, transparent);
}
.aidg-btn-ghost { background: transparent; border-color: transparent; }
.aidg-btn-ghost:hover { background: var(--aidg-soft); border-color: var(--aidg-border); color: var(--aidg-text); }

/* ----- Loader ----- */
.aidg-loader {
    display: inline-block; width: 18px; height: 18px;
    border: 2.5px solid color-mix(in srgb, var(--aidg-primary) 30%, transparent);
    border-top-color: var(--aidg-primary);
    border-radius: 50%;
    animation: aidg-spin 0.8s linear infinite;
}
@keyframes aidg-spin { to { transform: rotate(360deg); } }

/* ----- Toast / alert ----- */
.aidg-toast {
    position: fixed; bottom: 1.5rem; right: 1.5rem;
    z-index: 1080;
    background: var(--aidg-card);
    border: 1px solid var(--aidg-border);
    border-left: 4px solid var(--aidg-primary);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    box-shadow: var(--aidg-shadow-lg);
    color: var(--aidg-text);
    max-width: 360px;
    animation: aidg-toast-in 0.2s ease;
}
.aidg-toast.error   { border-left-color: #ef4444; }
.aidg-toast.success { border-left-color: var(--aidg-accent); }
@keyframes aidg-toast-in {
    from { transform: translateY(8px); opacity: 0; }
    to   { transform: translateY(0);   opacity: 1; }
}

/* ----- Section / feature cards ----- */
.aidg-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin: 3rem 0;
}
.aidg-feature {
    background: var(--aidg-card);
    border: 1px solid var(--aidg-border);
    border-radius: 12px;
    padding: 1.25rem;
    text-align: left;
    box-shadow: var(--aidg-shadow);
}
.aidg-feature .icon {
    width: 38px; height: 38px; border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    background: color-mix(in srgb, var(--aidg-primary) 15%, transparent);
    color: var(--aidg-primary);
    font-size: 1.1rem;
    margin-bottom: 0.6rem;
}
.aidg-feature h3 { font-size: 1.02rem; margin: 0 0 0.3rem; }
.aidg-feature p  { font-size: 0.88rem; color: var(--aidg-muted); margin: 0; }

/* ----- Footer ----- */
.aidg-footer {
    border-top: 1px solid var(--aidg-border);
    margin-top: 4rem;
    padding: 2rem 0;
    color: var(--aidg-muted);
    text-align: center;
    font-size: 0.9rem;
    background: var(--aidg-card);
}

/* ----- Auth / form pages ----- */
.aidg-auth-wrap {
    min-height: 80vh;
    display: flex; align-items: center; justify-content: center;
    padding: 2rem 1rem;
}
.aidg-auth-card {
    width: 100%;
    max-width: 440px;
}
.aidg-input {
    width: 100%;
    border-radius: 10px;
    border: 1px solid var(--aidg-border);
    background: var(--aidg-card);
    color: var(--aidg-text);
    padding: 0.7rem 0.9rem;
    font-size: 0.95rem;
}
.aidg-input:focus {
    outline: none;
    border-color: var(--aidg-primary);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--aidg-primary) 15%, transparent);
}

/* ----- Dashboard ----- */
.aidg-stat-card {
    background: var(--aidg-card);
    border: 1px solid var(--aidg-border);
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: var(--aidg-shadow);
}
.aidg-stat-card .num {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--aidg-primary);
}
.aidg-stat-card .lbl { color: var(--aidg-muted); font-size: 0.85rem; }

.aidg-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--aidg-card);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--aidg-border);
}
.aidg-table th, .aidg-table td {
    padding: 0.8rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--aidg-border);
    font-size: 0.92rem;
}
.aidg-table th {
    background: var(--aidg-soft);
    color: var(--aidg-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
}
.aidg-table tr:last-child td { border-bottom: 0; }

/* ----- Theme toggle ----- */
.aidg-theme-toggle {
    width: 38px; height: 38px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 10px;
    background: var(--aidg-soft);
    border: 1px solid var(--aidg-border);
    color: var(--aidg-text);
    cursor: pointer;
    transition: all 0.15s ease;
}
.aidg-theme-toggle:hover { color: var(--aidg-primary); border-color: var(--aidg-primary); }

/* ----- Misc ----- */
.aidg-quota {
    font-size: 0.85rem;
    color: var(--aidg-muted);
}
.aidg-quota strong { color: var(--aidg-text); }

.aidg-section-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 2.5rem 0 1rem;
    text-align: center;
}
.aidg-section-sub {
    color: var(--aidg-muted);
    text-align: center;
    max-width: 600px;
    margin: 0 auto 1.5rem;
}

.aidg-tool-desc {
    background: var(--aidg-soft);
    border-left: 3px solid var(--aidg-primary);
    border-radius: 8px;
    padding: 0.6rem 0.9rem;
    color: var(--aidg-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

@media (max-width: 768px) {
    .aidg-hero { padding: 3rem 0 1.5rem; }
    .aidg-tools { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
    .aidg-stat-card .num { font-size: 1.4rem; }
}
