/* =====================================================
   EduGen Pro — Public / Frontend Styles
   ===================================================== */

.edugen-frontend-wrap { max-width: 100%; }
.edugen-frontend-generator { display: flex; flex-direction: column; gap: 24px; }

/* ---- Generator Card ---- */
.edugen-gen-card {
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 4px 24px rgba(0,0,0,.06);
    overflow: hidden;
}
.edugen-gen-card-header {
    background: linear-gradient(135deg, #1e293b, #1a3a6e);
    padding: 24px 28px;
}
.edugen-gen-title { color: #fff; margin: 0 0 6px; font-size: 22px; font-weight: 800; }
.edugen-gen-subtitle { color: #94a3b8; margin: 0; font-size: 14px; }

.edugen-gen-form { padding: 24px 28px; display: flex; flex-direction: column; gap: 16px; }

.edugen-frontend-prompt {
    width: 100%;
    box-sizing: border-box;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px 16px;
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
    color: #1e293b;
    transition: border-color .2s, box-shadow .2s;
}
.edugen-frontend-prompt:focus {
    outline: none;
    border-color: var(--edugen-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.edugen-gen-params {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}
.edugen-gen-param-group { display: flex; flex-direction: column; gap: 5px; }
.edugen-gen-param-group label { font-size: 12px; font-weight: 600; color: #64748b; }
.edugen-gen-param-group input,
.edugen-gen-param-group select {
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    color: #1e293b;
    width: 100%;
    box-sizing: border-box;
    transition: border-color .2s;
}
.edugen-gen-param-group input:focus,
.edugen-gen-param-group select:focus { outline: none; border-color: var(--edugen-primary, #2563eb); }

.edugen-btn-generate {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--edugen-primary, #2563eb);
    color: #fff;
    border: none;
    border-radius: 9px;
    padding: 13px 24px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s, transform .1s;
}
.edugen-btn-generate:hover { background: #1d4ed8; }
.edugen-btn-generate:active { transform: scale(.98); }
.edugen-btn-generate:disabled { background: #93c5fd; cursor: not-allowed; }

/* ---- Loading State ---- */
.edugen-frontend-loading {
    text-align: center;
    padding: 48px 24px;
    color: #64748b;
}
.edugen-frontend-spinner { display: flex; justify-content: center; margin-bottom: 20px; }
.edugen-spin-ring {
    width: 52px; height: 52px;
    border: 4px solid #e2e8f0;
    border-top-color: var(--edugen-primary, #2563eb);
    border-radius: 50%;
    animation: edugen-spin 0.8s linear infinite;
}
@keyframes edugen-spin { to { transform: rotate(360deg); } }

/* ---- Error ---- */
.edugen-frontend-error {
    background: #fef2f2;
    border: 1.5px solid #fca5a5;
    border-radius: 10px;
    padding: 16px 20px;
    color: #b91c1c;
    font-size: 14px;
}

/* ---- Result ---- */
.edugen-frontend-result {
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 4px 24px rgba(0,0,0,.06);
    overflow: hidden;
}
.edugen-result-toolbar {
    background: #f0fdf4;
    border-bottom: 1px solid #bbf7d0;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}
.edugen-result-title-label { font-size: 15px; font-weight: 700; color: #166534; margin: 0; }
.edugen-result-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.edugen-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 7px;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    text-decoration: none;
    transition: background .15s;
}
.edugen-action-btn:hover { background: #f1f5f9; color: #1e293b; }

.edugen-result-document { padding: 24px; }

/* ---- Docs Grid ---- */
.edugen-docs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}
.edugen-doc-card {
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
    transition: box-shadow .2s, border-color .2s;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.edugen-doc-card:hover { box-shadow: 0 6px 24px rgba(37,99,235,.1); border-color: #93c5fd; }
.edugen-doc-card-header { display: flex; gap: 6px; align-items: center; }
.edugen-doc-card-level {
    background: #dbeafe;
    color: #1d4ed8;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
}
.edugen-doc-card-year { font-size: 12px; color: #94a3b8; margin-left: auto; }
.edugen-doc-card-title { font-size: 15px; font-weight: 700; color: #1e293b; margin: 0; }
.edugen-doc-card-title a { text-decoration: none; color: inherit; }
.edugen-doc-card-title a:hover { color: var(--edugen-primary, #2563eb); }
.edugen-doc-card-meta { font-size: 12px; color: #64748b; margin: 0; }
.edugen-doc-card-footer { margin-top: auto; display: flex; align-items: center; justify-content: space-between; }
.edugen-doc-card-date { font-size: 11px; color: #94a3b8; }
.edugen-doc-card-actions { display: flex; gap: 6px; }
.edugen-card-btn {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border: 1.5px solid #e2e8f0;
    border-radius: 6px;
    text-decoration: none;
    color: #374151;
    background: #f8fafc;
    transition: background .15s;
}
.edugen-card-btn:hover { background: #e2e8f0; color: #1e293b; }

.edugen-login-notice {
    background: #eff6ff;
    border: 1.5px solid #bfdbfe;
    border-radius: 10px;
    padding: 16px 20px;
    color: #1d4ed8;
    font-size: 14px;
}
.edugen-no-docs { color: #94a3b8; text-align: center; padding: 40px; }

/* =====================================================
   StudyHub — Redesigned Card Layout (v2)
   ===================================================== */

.studyhub-wrap { font-family: inherit; }

/* Hero */
.studyhub-hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a6e 60%, #1a4fbd 100%);
    border-radius: 18px;
    padding: 52px 32px;
    text-align: center;
    margin-bottom: 28px;
    position: relative;
    overflow: hidden;
}
.studyhub-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 70% 50%, rgba(99,179,237,.15), transparent 65%);
    pointer-events: none;
}
.studyhub-hero-inner { position: relative; z-index: 1; }
.studyhub-hero-icon  { font-size: 44px; display: block; margin-bottom: 10px; }
.studyhub-hero-title {
    color: #fff;
    font-size: clamp(26px, 5vw, 42px);
    font-weight: 900;
    margin: 0 0 10px;
    letter-spacing: -1px;
}
.studyhub-hero-sub {
    color: #94a3b8;
    font-size: 15px;
    margin: 0 0 22px;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
}
.studyhub-stats {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,.09);
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 50px;
    padding: 7px 20px;
    font-size: 13px;
    color: #cbd5e1;
}
.studyhub-stats strong { color: #fff; }
.studyhub-stat-sep { opacity: .35; }

/* Filters Bar */
.studyhub-filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    padding: 13px 16px;
    margin-bottom: 14px;
    box-shadow: 0 2px 10px rgba(0,0,0,.04);
}
.studyhub-search-wrap {
    flex: 1;
    min-width: 200px;
    position: relative;
    display: flex;
    align-items: center;
}
.studyhub-search-icon {
    position: absolute;
    left: 11px;
    font-size: 15px;
    pointer-events: none;
}
.studyhub-search {
    width: 100%;
    padding: 9px 12px 9px 36px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: #1e293b;
    box-sizing: border-box;
    transition: border-color .2s, box-shadow .2s;
}
.studyhub-search:focus {
    outline: none;
    border-color: var(--edugen-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.studyhub-filter-group { display: flex; gap: 8px; flex-wrap: wrap; }
.studyhub-select {
    padding: 8px 26px 8px 11px;
    border: 1.5px solid #e2e8f0;
    border-radius: 9px;
    font-size: 13px;
    font-family: inherit;
    color: #374151;
    background: #f8fafc;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 9px center;
    cursor: pointer;
    min-width: 120px;
    transition: border-color .2s;
}
.studyhub-select:focus { outline: none; border-color: var(--edugen-primary,#2563eb); }

/* Results bar */
.studyhub-results-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    min-height: 26px;
}
.studyhub-count { font-size: 13px; color: #64748b; font-weight: 600; }
.studyhub-clear-btn {
    background: none;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 12px;
    color: #64748b;
    cursor: pointer;
    transition: all .2s;
}
.studyhub-clear-btn:hover { border-color: #ef4444; color: #ef4444; }

/* Grid */
.studyhub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 22px;
}

/* Card */
.sh-card {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
    border: 1px solid #f1f5f9;
    transition: transform .22s, box-shadow .22s;
    display: flex;
    flex-direction: column;
}
.sh-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 36px rgba(0,0,0,.13);
}

/* Colored gradient banner */
.sh-card-banner {
    height: 150px;
    position: relative;
    display: flex;
    align-items: flex-end;
    padding: 14px 16px;
}
.sh-subject-chip {
    display: inline-block;
    background: rgba(255,255,255,.22);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,.35);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1px;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
}

/* Card body */
.sh-card-body {
    padding: 16px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}
.sh-card-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.45;
}
.sh-card-title a {
    color: inherit;
    text-decoration: none;
    transition: color .18s;
}
.sh-card-title a:hover { color: var(--edugen-primary, #2563eb); }

.sh-card-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.sh-tag {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
    background: #eff6ff;
    color: #2563eb;
}
.sh-tag-board { background: #f0fdf4; color: #16a34a; }

/* Footer */
.sh-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid #f1f5f9;
}
.sh-read-link {
    font-size: 13px;
    font-weight: 600;
    color: var(--edugen-primary, #2563eb);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 3px;
    transition: gap .15s;
}
.sh-read-link:hover { gap: 6px; }
.sh-arrow { font-size: 16px; line-height: 1; }
.sh-read-muted { font-size: 13px; color: #94a3b8; }

.sh-card-actions { display: flex; gap: 5px; }
.sh-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: #f1f5f9;
    font-size: 14px;
    text-decoration: none;
    transition: background .18s;
    border: 1px solid #e2e8f0;
}
.sh-icon-btn:hover { background: #e2e8f0; }

/* Empty */
.studyhub-empty, .studyhub-no-results {
    text-align: center;
    padding: 60px 20px;
    color: #64748b;
}
.studyhub-empty-icon { font-size: 52px; margin-bottom: 14px; }
.studyhub-empty h3, .studyhub-no-results h3 { color: #1e293b; margin: 0 0 6px; }
.studyhub-empty p, .studyhub-no-results p { margin: 0; }

/* Responsive */
@media (max-width: 640px) {
    .studyhub-hero { padding: 36px 16px; }
    .studyhub-filters-bar { flex-direction: column; }
    .studyhub-search-wrap { width: 100%; }
    .studyhub-filter-group { width: 100%; }
    .studyhub-select { flex: 1; min-width: 0; }
    .studyhub-grid { grid-template-columns: 1fr 1fr; gap: 14px; }
    .sh-card-banner { height: 110px; }
}
@media (max-width: 400px) {
    .studyhub-grid { grid-template-columns: 1fr; }
}
