* {
    box-sizing: border-box;
}

body {
    font-family: 'Heebo', sans-serif;
    background: #f5f5f5;
    margin: 0;
    direction: rtl;
}

/* ─── App Bar ─── */
.mdl-layout__header {
    background: #3949AB;
}

.mdl-layout-title {
    font-size: 1.25rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* ─── Hero ─── */
.hero {
    background: linear-gradient(135deg, #3949AB 0%, #1565C0 100%);
    color: #fff;
    padding: 56px 24px 72px;
    text-align: center;
}

.hero h1 {
    margin: 0 0 12px;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.hero p {
    margin: 0;
    font-size: 1.1rem;
    opacity: 0.85;
    font-weight: 300;
}

/* ─── Cards Grid ─── */
.cards-section {
    max-width: 1100px;
    margin: -36px auto 48px;
    padding: 0 24px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.query-card {
    background: #ffffff;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 1px 8px rgba(0, 0, 0, .08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s, transform 0.2s;
    text-decoration: none;
    color: inherit;
}

.query-card:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, .18);
    transform: translateY(-2px);
}

/* Colored top strip */
.card-stripe {
    height: 6px;
}

.card-body {
    padding: 20px 20px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.card-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.card-icon .material-icons {
    font-size: 22px;
    color: #fff;
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: #212121;
    margin: 0;
}

.card-description {
    font-size: 0.875rem;
    color: #616161;
    line-height: 1.5;
    margin: 0;
    flex: 1;
}

.card-vars {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.var-header {
    display: flex;
    align-items: center;
    gap: 0.5em;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #3949AB;
}

.var-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #EDE7F6;
    color: #4527A0;
    border-radius: 12px;
    padding: 2px 10px;
    font-size: 0.75rem;
    font-weight: 500;
}

.var-icon {
    align-content: center;
}

.var-icon.event {
    font-size: 0.75rem;
}

.card-footer {
    padding: 10px 20px 14px;
    display: flex;
    justify-content: flex-end;
}

.card-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-family: 'Heebo', sans-serif;
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    border-radius: 4px;
    transition: background 0.15s;
    text-decoration: none;
}

.card-btn:hover {
    background: rgba(57, 73, 171, 0.08);
}

/* ─── Empty state ─── */
.empty-state {
    text-align: center;
    padding: 80px 24px;
    color: #9E9E9E;
    grid-column: 1 / -1;
}

.empty-state .material-icons {
    font-size: 64px;
    display: block;
    margin-bottom: 16px;
    opacity: 0.4;
}

/* ─── Footer ─── */
footer {
    text-align: center;
    padding: 24px;
    font-size: 0.8rem;
    color: #9E9E9E;
}

/* ══════════════════════════════════════
   query.php
══════════════════════════════════════ */

/* ─── Page wrapper ─── */
.page-wrap { max-width: 900px; margin: 32px auto; padding: 0 20px 60px; }

/* ─── Back link ─── */
.back-link {
    display: inline-flex; align-items: center; gap: 4px;
    color: #3949AB; font-size: .875rem; font-weight: 500;
    text-decoration: none; margin-bottom: 20px;
    padding: 4px 0; border-radius: 4px;
    transition: opacity .15s;
}
.back-link:hover { opacity: .7; }

/* ─── Header card ─── */
.query-header {
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,.12);
    overflow: hidden;
    margin-bottom: 24px;
}
.query-header-stripe { height: 6px; }
.query-header-body { padding: 20px 24px; display: flex; align-items: center; gap: 16px; }
.query-header-icon {
    width: 48px; height: 48px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.query-header-icon .material-icons { font-size: 26px; color: #fff; }
.query-header-text h1 { margin: 0 0 4px; font-size: 1.25rem; font-weight: 700; color: #212121; }
.query-header-text p  { margin: 0; font-size: .9rem; color: #616161; }

/* ─── SQL Preview ─── */
.sql-card {
    background: #263238; border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,.2);
    margin-bottom: 24px; overflow: hidden;
}
.sql-card-label {
    display: flex; align-items: center; gap: 6px;
    background: #37474F; color: #90A4AE;
    font-size: .75rem; font-weight: 700; letter-spacing: .08em;
    padding: 6px 16px;
}
.sql-card-label .material-icons { font-size: 14px; }
.sql-card pre {
    margin: 0; padding: 16px;
    color: #E0F2F1; font-family: 'Courier New', monospace; font-size: .85rem;
    line-height: 1.7; white-space: pre-wrap; word-break: break-all;
}

/* ─── Form card ─── */
.form-card {
    background: #fff; border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,.12);
    padding: 24px; margin-bottom: 24px;
}
.form-card h2 {
    margin: 0 0 20px; font-size: 1rem; font-weight: 700;
    color: #424242; display: flex; align-items: center; gap: 8px;
}
.form-card h2 .material-icons { font-size: 18px; color: #7986CB; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 24px; }

.field-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-label {
    font-size: .8rem;
    font-weight: 600;
    color: #5C6BC0;
    letter-spacing: .03em;
}

.field-input {
    width: 100%;
    padding: 10px 12px;
    font-family: 'Heebo', sans-serif;
    font-size: .95rem;
    color: #212121;
    background: #fff;
    border: 1.5px solid #C5CAE9;
    border-radius: 6px;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    direction: rtl;
    box-sizing: border-box;
}

.field-input::placeholder {
    color: #BDBDBD;
    font-style: italic;
    font-size: .85rem;
}

.field-input:focus {
    border-color: #3949AB;
    box-shadow: 0 0 0 3px rgba(57,73,171,.12);
}

.form-actions { margin-top: 16px; display: flex; justify-content: flex-end; }

/* ─── Error alert ─── */
.alert-error {
    background: #FFEBEE; border-right: 4px solid #C62828;
    border-radius: 4px; padding: 14px 16px; margin-bottom: 24px;
    display: flex; align-items: flex-start; gap: 10px; color: #B71C1C;
    font-size: .875rem; line-height: 1.5;
}
.alert-error .material-icons { font-size: 20px; flex-shrink: 0; margin-top: 1px; }

/* ─── Final SQL output ─── */
.final-card {
    background: #fff; border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,.12);
    overflow: hidden; margin-top: 24px;
}
.final-card-header {
    display: flex; align-items: center; justify-content: space-between;
    background: #1A237E; padding: 10px 16px;
}
.final-card-header span {
    display: flex; align-items: center; gap: 6px;
    color: #C5CAE9; font-size: .75rem; font-weight: 700; letter-spacing: .08em;
}
.final-card-header span .material-icons { font-size: 14px; }
.copy-btn {
    display: inline-flex; align-items: center; gap: 4px;
    background: #3949AB; color: #fff;
    border: none; border-radius: 3px;
    padding: 4px 12px; font-size: .75rem; font-weight: 700;
    cursor: pointer; font-family: 'Heebo', sans-serif;
    transition: background .15s;
}
.copy-btn:hover { background: #5C6BC0; }
.copy-btn.copied { background: #2E7D32; }
#final-sql {
    margin: 0; padding: 18px 16px;
    color: #E0F2F1; background: #263238;
    font-family: 'Courier New', monospace; font-size: .875rem;
    line-height: 1.8; white-space: pre-wrap; word-break: break-all;
    min-height: 60px;
}