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

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, sans-serif;
    background: #0d4d68;
    color: white;
    overflow-x: auto;
    margin-left: 20px;
}

/* =========================
   BACKGROUND GLOW
========================= */

.background-glow {
    position: fixed;
    width: 700px;
    height: 700px;
    background: radial-gradient(circle, rgba(56,189,248,0.25), transparent 70%);
    top: -250px;
    right: -250px;
    z-index: 0;
    filter: blur(140px);
}

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

.layout {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* =========================
   TITLES
========================= */

.gradient-title {
    font-size: 2.6rem;
    font-weight: 700;
    background: linear-gradient(90deg, #38bdf8, #6366f1);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: #94a3b8;
    font-size: 0.95rem;
    margin-top: 10px;
}

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

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 30px;
    margin: 50px 0;
}

.two-stats {
    grid-template-columns: repeat(auto-fit, minmax(250px, 350px));
    justify-content: center;
}

.stat-card {
    background: rgba(30,41,59,0.6);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.05);
    transition: 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(56,189,248,0.2);
}

.stat-card h2 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: #38bdf8;
}

.stat-card p {
    color: #cbd5f5;
}

/* =========================
   CARDS
========================= */

.card {
    background: rgba(30,41,59,0.6);
    backdrop-filter: blur(10px);
    border-radius: 18px;
    padding: 28px;
    margin-bottom: 25px;
    border: 1px solid rgba(255,255,255,0.05);
    transition: 0.3s ease;
}

.card:hover {
    transform: translateY(-6px);
    box-shadow: 0 15px 35px rgba(56,189,248,0.15);
}

/* =========================
   CARD HEADER ALIGNMENT
========================= */

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #38bdf8;
    margin-bottom: 30px;
}

.card-header h3 {
    margin: 0;
    font-size: 1.3rem;
}

/* =========================
   MODULE BADGE (Single Clean Version)
========================= */

.module-badge {
    background: linear-gradient(90deg, #38bdf8, #6366f1);
    color: white;
    padding: 6px 14px;
    font-size: 0.75rem;
    border-radius: 20px;
    font-weight: 500;
    white-space: nowrap;
}

/* =========================
   RECENT SECTION
========================= */

.recent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

.desc {
    color: #94a3b8;
    font-size: 0.9rem;
}

.card-footer {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
}

.card-footer a {
    color: #38bdf8;
    text-decoration: none;
    font-size: 0.85rem;
}

.card-footer a:hover {
    text-decoration: underline;
}

/* =========================
   FORMS
========================= */

.form-card {
    background: rgba(30,41,59,0.6);
    backdrop-filter: blur(12px);
    padding: 40px;
    border-radius: 20px;
    max-width: 700px;
    border: 1px solid rgba(255,255,255,0.05);
}

label {
    display: block;
    margin-bottom: 8px;
    margin-top: 20px;
    font-size: 0.9rem;
    color: #cbd5f5;
}

input,
textarea {
    width: 100%;
    padding: 14px;
    border-radius: 10px;
    border: none;
    background: #0f172a;
    color: white;
    font-size: 0.95rem;
}

textarea {
    min-height: 130px;
    resize: vertical;
}

input:focus,
textarea:focus {
    outline: 1px solid #38bdf8;
}

/* Buttons */

.primary-btn,
button {
    background: linear-gradient(90deg, #38bdf8, #6366f1);
    border: none;
    padding: 14px 22px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    color: white;
    transition: 0.3s ease;
}

.primary-btn:hover,
button:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(56,189,248,0.3);
}

/* =========================
   SEARCH PAGE
========================= */

.search-card {
    margin-bottom: 40px;
}

.search-form {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-form input {
    flex: 1;
    height: 48px;
    margin: 0;
}

.search-form button {
    height: 48px;
    margin: 0;
}

.results-count {
    margin-bottom: 20px;
    color: #94a3b8;
}

.search-result-card h3 {
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.detail-block {
    margin-top: 18px;
}

.label {
    display: block;
    font-size: 1.0rem;
    font-weight: 600;
    color: #f5f7f9;      
    margin-bottom: 20px;
    letter-spacing: 0.3px;
    text-transform: uppercase;  
}

.detail-block p {
    font-size: 0.90rem;
    font-weight: 400;
    color: #afd0ff;     
    margin: 20px;
    line-height: 1.5;
}

.detail-block:last-child {
    border-bottom: none;
}

.empty-state {
    text-align: center;
    margin-top: 80px;
    color: #94a3b8;
}

.empty-state h3 {
    font-size: 1.5rem;
    color: white;
    margin-bottom: 10px;
}

/* =========================
   MODULES PAGE
========================= */

.modules-container {
    display: flex;
    gap: 40px;
    width: 100%;
    align-items: flex-start;
}

.module-list {
    flex: 0 0 260px; /* fixed sidebar width */
    background: rgba(30,41,59,0.6);
    backdrop-filter: blur(12px);
    padding: 25px;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.05);
    height: calc(100vh - 140px); /* fill vertical space */
    overflow-y: auto;
}

.module-list a {
    display: block;
    margin-bottom: 15px;
    color: #94a3b8;
    text-decoration: none;
    transition: 0.2s ease;
}

.module-list a:hover,
.module-list a.active {
    color: #38bdf8;
    font-weight: 600;
}

/* Right side should fill remaining space */
.module-queries {
    flex: 1;
    min-width: 0; /* prevents overflow issues */
    width: 100%;
}

/* =========================
   PRE CODE BLOCK
========================= */

pre {
    background: #0f172a;
    padding: 15px;
    border-radius: 12px;
    overflow-x: auto;
    font-size: 0.85rem;
    color: #38bdf8;
}

/* =========================
   MANAGE ACTION BUTTONS
========================= */

.manage-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.action-btn {
    padding: 10px 18px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    transition: 0.25s ease;
    color: white;
    display: inline-block;
}

/* Edit Button */
.edit-btn {
    background: #22c55e;
}

.edit-btn:hover {
    background: #16a34a;
    transform: translateY(-2px);
}

/* Delete Button */
.delete-btn {
    background: #ef4444;
}

.delete-btn:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.query-preview {
    max-height: 4.5em;   /* ~3 lines */
    overflow: hidden;
    position: relative;
    background: #0f172a;
    color: #e2e8f0;
    padding: 12px;
    border-radius: 6px;
    white-space: pre-wrap;
    transition: max-height 0.3s ease;
    margin-left: 20px;
    margin-right: 20px;
}

.query-preview.expanded {
    max-height: 1000px;
}

.query-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

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

.copy-btn {
    background: #22c55e;
    color: white;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.copy-btn:hover {
    background: #16a34a;
}

.expand-btn {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.expand-btn:hover {
    background: #2563eb;
}

.copy-toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #22c55e;
    color: white;
    padding: 12px 18px;
    border-radius: 8px;
    font-size: 14px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.2);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 9999;
}

.copy-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.form-group {
    margin-bottom: 18px;
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 6px;
    color: #2c2c2c;
}

.custom-select-wrapper {
    position: relative;
}

.custom-select {
    width: 100%;
    padding: 10px 40px 10px 12px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    font-size: 14px;
    background: #ffffff;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    transition: all 0.25s ease;
}
.custom-select:focus {
    outline: none;
    border-color: #6a5cff;
    box-shadow: 0 0 0 2px rgba(106, 92, 255, 0.15);
}

.custom-select-wrapper::after {
    content: "▼";
    font-size: 12px;
    color: #6a5cff;
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

.custom-select:hover {
    border-color: #6a5cff;
}

/* Glossary Page */

.glossary-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.glossary-card {
    background: rgba(30,41,59,0.6);
    backdrop-filter: blur(12px);
    padding: 25px;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.05);
}

.glossary-card h2 {
    margin-bottom: 15px;
    color: #38bdf8;
}

.glossary-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.glossary-table th,
.glossary-table td {
    padding: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.glossary-table th {
    color: #94a3b8;
    text-align: left;
}

.glossary-table tr:hover {
    background: rgba(56,189,248,0.05);
}

.search-input {
    margin-bottom: 20px;
}

.modules-container {
    margin-top: 10px;
}

/* ADMIN SIDEBAR */

.admin-header{
    font-size:14px;
    color:#9ca3af;
    margin-bottom:10px;
}

.admin-link{
    display:block;
    padding-left:10px;
    text-decoration:none;
    color:#e5e7eb;
    font-size:14px;
    transition:background 0.2s;
}

.admin-link:hover{
    background:rgba(255,255,255,0.08);
}

.admin-divider{
    height:1px;
    background:rgba(255,255,255,0.1);
}

/* DASHBOARD HEADER LAYOUT */

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

/* ADMIN LOGIN BUTTON */

.admin-login-btn{
    padding:10px 18px;
    border-radius:8px;
    text-decoration:none;
    font-size:14px;
    font-weight:600;
    color:white;
    background:linear-gradient(135deg,#6366f1,#3b82f6);
    transition:0.2s ease;
}

.admin-login-btn:hover{
    transform:translateY(-1px);
    box-shadow:0 4px 10px rgba(0,0,0,0.2);
}

.queries_table-table-container {
    width: 100%;
    overflow-x: auto;
    margin-top: 30px;
}

.queries_table-table {
    border-collapse: collapse;
    min-width: 1200px;
    width: 100%;
}

.queries_table-table th,
.queries_table-table td {
    padding: 10px 14px;
    border: 1px solid rgba(255,255,255,0.1);
    text-align: left;
}

.queries_table-table th {
    background: rgba(30,41,59,0.9);
    color: #38bdf8;
}

.queries_table-table tr:nth-child(even) {
    background: rgba(255,255,255,0.02);
}

.delete-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 6px 12px;
    cursor: pointer;
    border-radius: 6px;
}

.delete-btn:hover {
    background: #c82333;
}

.login-container {
    width: 380px;
    margin: 80px auto;
    padding: 35px;
    background: rgba(30,41,59,0.6);
    backdrop-filter: blur(12px);

    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.05);

    text-align: center;
}

.login-container h2 {
    margin-bottom: 25px;
}

.login-container input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;

    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.08);

    background: rgba(15,23,42,0.8);
    color: white;
}

.login-container button {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;

    background: linear-gradient(135deg,#38bdf8,#6366f1);
    color: white;
    font-weight: 600;
    cursor: pointer;

    transition: 0.2s;
}

.login-container button:hover {
    transform: translateY(-2px);
}

.dashboard-header{
    display:flex;
    justify-content:space-between;
    align-items:flex-start;
}

.header-right{
    display:flex;
    flex-direction:column;
    align-items:flex-end;
}

/* SIDEBAR */
.sidebar{
    width:240px;
    height:100vh;
    position:fixed;
    top:0;
    left:0;
    background: #0b1120;
    backdrop-filter: blur(12px);
    transition: all 0.3s ease;
    overflow-y:auto;
    padding:15px;
}

/* TOP */
.sidebar-top{
    display:flex;
    justify-content:space-between;
    align-items:center;
    margin-bottom:20px;
}

/* LOGO */

.logo{
    font-size:30px;
    font-weight:bold;
    text-align:center;
    text-decoration:none; 
    background: linear-gradient(90deg,#38bdf8, #6366f1);

    -webkit-background-clip: text;
    background-clip: text;

    -webkit-text-fill-color: transparent;
    color: transparent;
}

.logo:hover{
    transform: scale(1.05);
    transition: 0.2s;
}

/* NAV */
.nav{
    display:flex;
    flex-direction:column;
    gap:8px;
}

/* NAV ITEM */
.nav-item{
    display:flex;
    align-items:center;
    gap:12px;
    padding:10px;
    border-radius:10px;
    color:#ccc;
    text-decoration:none;
    transition: all 0.3s ease;
}

/* ICON */
.icon{
    font-size:16px;
}

/* TEXT */
.text{
    transition: opacity 0.2s;
}

/* HOVER */
.nav-item:hover{
    background: linear-gradient(90deg,#38bdf8, #6366f1);
    color:white;
    transform: translateX(5px);
}

/* ACTIVE */
.nav-item.active{
    background: linear-gradient(90deg,#38bdf8, #6366f1);
    color:white;
}

/* ADMIN */
.admin-section{
    margin-top:20px;
    border-top:1px solid rgba(255,255,255,0.1);
    padding-top:10px;
}

.admin-title{
    font-size:12px;
    color:#888;
    margin-bottom:8px;
}

/* LOGOUT */
.logout{
    color:#ff6b6b;
}


/* CONTENT SHIFT */
.content{
    margin-left:240px;
    padding:20px;
    transition: all 0.3s ease;
}

.layout {
    display: flex;
}

.sidebar {
    width: 240px;
    position: fixed;
    height: 100vh;
}

.content {
    margin-left: 240px;
    padding: 20px;
    width: 100%;
}

/* Push footer to bottom */
.sidebar{
    display:flex;
    flex-direction:column;
}

/* Make nav take available space */
.nav{
    flex:1;
}

/* Footer container */
.sidebar-footer{
    display:flex;
    justify-content:center;
    padding-top:20px;
    border-top:1px solid rgba(255,255,255,0.08);
}

.sidebar-footer-logo{
    filter: brightness(0) invert(1);
}

/* Logo */
.sidebar-footer-logo{
    width:100px;
    display:block;
}


.export-section{
    margin-top:20px;
}

.export-card{
    display:flex;
    justify-content:space-between;
    align-items:center;

    background: rgba(255,255,255,0.04);
    border:1px solid rgba(255,255,255,0.08);
    border-radius:12px;

    padding:20px;
}

/* TEXT */
.export-info h3{
    margin-bottom:5px;
}

.export-info p{
    font-size:13px;
    color:#94a3b8;
}

/* BUTTON (same theme) */
.export-btn{
    background: linear-gradient(90deg,#38bdf8, #6366f1);
    border:none;
    color:white;
    padding:8px 16px;
    border-radius:8px;
    cursor:pointer;

    transition:0.2s;
}

.export-btn:hover{
    transform: translateY(-2px);
    box-shadow: 0 0 10px rgba(106,17,203,0.4);
}

.export-btn:disabled{
    opacity:0.6;
}