html {
    tab-size: 4;
    font-family: ui-sans-serif, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;
}

.hidden {
    display: none;
}

.app {
    min-height: calc(100vh - 57px);
    background-color: #0f172a;
    color: #f1f5f9;
}

.nav {
    background-color: #1e293b;
    padding: 1rem;
    border-bottom: 1px solid #334155;
}

.nav__container {
    max-width: 72rem;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav__brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;

    color: inherit;
    text-decoration: none;
}

.nav__brand:hover {
    color: #c084fc;
}

.nav__icon {
    width: 1.5rem;
    height: 1.5rem;
    color: #c084fc;

    position: relative;
    top: 0.1rem;
}

.nav__title {
    font-size: 1.25rem;
    font-weight: 600;
}

.nav__tabs {
    display: flex;
    gap: 1rem;
}

.nav__tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
}

.nav__tab:hover {
    background-color: #334155;
}

.nav__tab--active {
    background-color: #7e22ce;
}

.nav__tab-icon {
    width: 1rem;
    height: 1rem;
}

.nav__link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #94a3b8;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    transition: color 0.2s, background-color 0.2s;
}

.nav__link:hover {
    color: #f1f5f9;
    background-color: #334155;
}

.nav__link-icon {
    width: 1rem;
    height: 1rem;
}

.main-container {
    max-width: 72rem;
    margin: 0 auto;
    padding: 1.5rem;
}

.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 1024px) {
    .grid {
        grid-template-columns: 1fr;
        max-width: 48rem;
        margin: 0 auto;
    }
}

.panel {
    background-color: #1e293b;
    border-radius: 0.5rem;
    padding: 1.5rem;
    border: 1px solid #334155;
}

.panel__title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.panel__text {
    color: #cbd5e1;
    margin-bottom: 1rem;
}

.panel__text p {
    margin: 1rem 0;
}

.panel__text code {
    background-color: #1e1815;
    color: #ff9e64;
    padding: 0.2rem 0.4rem;
    border-radius: 0.2rem;
    font-family: ui-monospace, monospace;
    text-shadow: 0 0 8px rgba(255, 158, 100, 0.3);
}

.table-info {
    background-color: #0f172a;
    border-radius: 0.5rem;
}

.table-info__details {
    font-size: 0.875rem;
    color: #94a3b8;
}

.table-info__summary {
    cursor: pointer;

    padding: 1rem;
    user-select: none;
}

.table-info__summary:hover {
    color: #f1f5f9;
}

.table-info__title {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;

    display: inline;
}

.table-info__schema {
    font-size: 0.875rem;
    color: #cbd5e1;
    overflow: auto;

    max-width: calc(48rem - 3.15rem);
    max-height: 20rem;

    margin: 0;
    padding: 0 1rem;

    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.editor__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;

    text-decoration: none;
}

.button--primary {
    background-color: #7e22ce;
    color: white;
}

.button--primary:hover {
    background-color: #6b21a8;
}

.button--secondary {
    background-color: #334155;
    color: white;
}

.button--secondary:hover {
    background-color: #475569;
}

.button--text {
    background: none;
    color: #94a3b8;
    padding: 0;
}

.button--text:hover {
    color: #f1f5f9;
}

.button__icon {
    width: 1rem;
    height: 1rem;
}

.editor__textarea {
    width: 100%;
    height: 16rem;
    background-color: #0f172a;
    color: #f1f5f9;
    border-radius: 0.5rem;
    font-family: monospace;
    font-size: 0.875rem;
    border: none;
    margin-bottom: 1rem;
}

.editor__textarea:focus {
    outline: 2px solid #7e22ce;
}

.expected-query {
    background-color: #0f172a;
    padding: 1rem;
    border-radius: 0.5rem;
}

.expected-query__header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #4ade80;
    margin-bottom: 0.5rem;
}

.expected-query__icon {
    width: 1rem;
    height: 1rem;
}

.expected-query__title {
    font-size: 0.875rem;
    font-weight: 600;
}

.expected-query__code {
    font-size: 0.875rem;
    color: #cbd5e1;
}

.panel--results {
    margin-top: 1.5rem;
}

.results-table {
    overflow-x: auto;
}

.results-table__error {
    padding: 1rem;
    background-color: #ef4444;
    border-radius: 0.5rem;

    color: #f1f5f9;
}

.table {
    width: 100%;
    font-size: 0.875rem;
    border-collapse: collapse;
}

.table__header {
    padding: 0.5rem 1rem;
    text-align: left;
    color: #94a3b8;
    font-weight: 500;
    border-bottom: 1px solid #334155;
}

.table__header--actions {
    text-align: right;
    width: 200px;
}

.table__cell {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid #334155;
}

.table__cell--actions {
    text-align: right;
    white-space: nowrap;
}

.exercises {
    background-color: #1e293b;
    border-radius: 0.5rem;
    padding: 1.5rem;
    border: 1px solid #334155;
}

.exercises__title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.exercises__container {
    overflow-x: auto;
}

.exercises-table {
    width: 100%;
    border-collapse: collapse;
}

.exercises-table__header {
    padding: 1rem;
    text-align: left;
    color: #94a3b8;
    font-weight: 500;
    border-bottom: 1px solid #334155;
}

.exercises-table__header--center {
    text-align: center;
}

.exercises-table__row {
    border-bottom: 1px solid #334155;
    transition: background-color 0.2s;
}

.exercises-table__row:hover {
    background-color: #2d3b4f;
}

.exercises-table__cell {
    padding: 1rem;
}

.exercises-table__cell--center {
    text-align: center;
}

.exercise-link {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: inherit;
    padding: 0;
    text-align: left;
    width: 100%;
    transition: color 0.2s;
    display: block;
    padding: 0.5rem 0;
    text-decoration: none;
}

.exercise-link:hover {
    color: #c084fc;
}

.status-icon {
    width: 1.25rem;
    height: 1.25rem;

    margin: 0 auto;
}

.status-icon--completed {
    color: #4ade80;
}

.status-icon--pending {
    color: #94a3b8;
    font-size: 1.25rem;
}

.content {
    background-color: #1e293b;
    border-radius: 0.5rem;
    padding: 1.5rem;
    border: 1px solid #334155;
}

.content__header,
.content__subheader,
.exercises__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.content__title {
    font-size: 1.5rem;
    font-weight: 600;
}

.table-container {
    overflow-x: auto;
}

.icon-button {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 0.5rem;
    margin-left: 0.5rem;

    display: inline-block;
}

.icon-button:hover {
    color: #f1f5f9;
}

.icon-button--danger:hover {
    color: #ef4444;
}

.icon-button__icon {
    width: 1rem;
    height: 1rem;
}

.form {
    max-width: 48rem;
    margin: 0 auto;
}

.form__title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.form__group {
    margin-bottom: 1.5rem;
}

.form__label {
    display: block;
    margin-bottom: 0.5rem;
    color: #94a3b8;
    font-size: 0.875rem;
}

.form__input {
    width: 100%;
    padding: 0.5rem;
    background-color: #0f172a;
    border: 1px solid #334155;
    border-radius: 0.375rem;
    color: #f1f5f9;
}

.form__input:focus {
    outline: none;
    border-color: #7e22ce;
}

.form__textarea {
    width: 100%;
    padding: 0.5rem;
    background-color: #0f172a;
    border: 1px solid #334155;
    border-radius: 0.375rem;
    color: #f1f5f9;
    min-height: 100px;
    font-family: monospace;
}

.form__textarea:focus {
    outline: none;
    border-color: #7e22ce;
}

.form__actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

.editor__actions {
    display: flex;
    gap: 0.75rem;
}

.solution-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    margin: 1rem 0;
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.solution-status--correct {
    background-color: rgba(34, 197, 94, 0.1);
    color: #4ade80;
    border: 1px solid rgba(74, 222, 128, 0.2);
}

.solution-status--incorrect {
    background-color: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(248, 113, 113, 0.2);
}

.solution-status__icon {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

.footer {
    background-color: #1e293b;
    border-top: 1px solid #334155;
    padding: 1rem 0;
    margin-top: auto;
}

.footer__container {
    max-width: 72rem;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.footer__content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer__text {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #94a3b8;
}

.footer__icon {
    width: 1rem;
    height: 1rem;

    margin: 0 -0.1rem;
}

.footer__icon--heart {
    color: #f43f5e;
}

.footer__link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.2s;

    margin: 0 -0.1rem;
}

.footer__link:hover {
    color: #f1f5f9;
}

/* Hidden checkbox */
.schema-toggle {
    display: none;
}

/* Sidebar */
.schema-sidebar {
    position: fixed;
    top: 0;
    right: -28rem;
    /* Start off-screen */
    width: 28rem;
    height: 100vh;
    background-color: #1e293b;
    border-left: 1px solid #334155;
    transition: all 0.3s ease-in-out;
    transition-property: right, width;
    z-index: 49;
}

/* Show sidebar when checkbox is checked */
.schema-toggle:checked~.schema-sidebar {
    right: 0;
    transition-property: right;
}


.schema-sidebar__draghandle {
    position: absolute;
    width: 1rem;
    height: 2rem;
    background-color: #1e293b;
    z-index: 50;
    left: -1rem;
    top: 1rem;
    border: 1px solid #334155;
    display: none; /* hiding by default */
    justify-content: center;
    align-items: center;
    border-radius: 2px 0 0 2px;

    cursor: grab;
    user-select: none;
}

/* Show sidebar handle when checkbox is checked */
.schema-toggle:checked~.schema-sidebar > .schema-sidebar__draghandle {
    display: flex;
}

.schema-sidebar__draghandle::after {
    content: '\283F';
}

.schema-sidebar__draghandle:active {
    cursor: grabbing;
}

.schema-sidebar__content {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.schema-sidebar__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #334155;
    position: sticky;
    top: 0;
    background-color: #1e293b;
    z-index: 1;
}

.schema-sidebar__title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #f1f5f9;
}

.schema-sidebar__body {
    padding: 1rem;
    overflow: auto;
}

.sql-hl-keyword {
    color: #569cd6;
}

.sql-hl-function {
    color: #dcdcaa;
}

.sql-hl-number {
    color: #b5cea8;
}

.sql-hl-string {
    color: #ce9178;
}

.sql-hl-special {
    color: #c586c0;
}

.sql-hl-bracket {
    color: #ffd700;
}
