/*
 * quamina-rs playground
 * Styling based on rishi.baldawa.com (barebones/vncnt theme)
 */

/* CSS Variables - matching barebones.css */
:root {
    --theme-hue: 0;
    --accent-hue: 194;

    --text-color-richer: hsl(var(--theme-hue), 0%, 5%);
    --text-color-normal: hsl(var(--theme-hue), 0%, 13%);
    --text-color-softer: hsl(var(--theme-hue), 0%, 33%);

    --accent-color: hsl(var(--accent-hue), 86%, 57%);
    --accent-color-hover: hsl(var(--accent-hue), 76%, 49%);

    --border-color: hsl(var(--theme-hue), 0%, 73%);
    --border-color-softer: hsl(var(--theme-hue), 0%, 82%);

    --background-color: white;
    --background-color-softer: hsl(var(--theme-hue), 0%, 95%);
    --code-background: hsl(var(--theme-hue), 0%, 95%);

    --success-color: hsl(145, 63%, 42%);
    --error-color: hsl(0, 65%, 51%);

    --font-family: "Raleway", "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif;
    --mono: 'SF Mono', Monaco, Consolas, 'Courier New', monospace;
}

/* Dark theme */
@media (prefers-color-scheme: dark) {
    :root {
        --text-color-richer: hsl(var(--theme-hue), 0%, 95%);
        --text-color-normal: hsl(var(--theme-hue), 0%, 80%);
        --text-color-softer: hsl(var(--theme-hue), 0%, 67%);

        --accent-color: hsl(var(--accent-hue), 76%, 49%);
        --accent-color-hover: hsl(var(--accent-hue), 86%, 57%);

        --border-color: hsl(var(--theme-hue), 0%, 27%);
        --border-color-softer: hsl(var(--theme-hue), 0%, 20%);

        --background-color: hsl(var(--theme-hue), 0%, 12%);
        --background-color-softer: hsl(var(--theme-hue), 0%, 18%);
        --code-background: hsl(var(--theme-hue), 0%, 5%);

        --success-color: hsl(145, 63%, 49%);
        --error-color: hsl(0, 70%, 60%);
    }
}

/* Reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Base */
html {
    font-size: 62.5%;
    scroll-behavior: smooth;
}

body {
    font-size: 1.6rem;
    line-height: 1.6;
    font-weight: 400;
    font-family: var(--font-family);
    color: var(--text-color-normal);
    background-color: var(--background-color-softer);
}

/* Header */
header.header {
    background: var(--text-color-richer);
    color: var(--background-color);
    padding: 1.5rem 2rem;
    text-align: center;
}

header.header h1 {
    font-size: 2.4rem;
    font-weight: 300;
    margin-bottom: 0.5rem;
    letter-spacing: -0.05rem;
}

header.header p {
    font-size: 1.4rem;
    opacity: 0.85;
}

/* Layout */
main.container {
    max-width: 140rem;
    margin: 0 auto;
    padding: 1.5rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    min-height: calc(100vh - 12rem);
}

/* Panels */
.panel {
    background: var(--background-color);
    border-radius: 4px;
    border: 1px solid var(--border-color-softer);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    background: var(--text-color-richer);
    color: var(--background-color);
    padding: 1rem 1.5rem;
    font-weight: 600;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-btn {
    display: inline-block;
    height: 2.8rem;
    padding: 0 1.5rem;
    color: var(--text-color-softer);
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    line-height: 2.6rem;
    letter-spacing: 0.1rem;
    text-transform: uppercase;
    background-color: transparent;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    cursor: pointer;
}

.header-btn:hover,
.header-btn:focus {
    color: var(--background-color);
    border-color: var(--text-color-softer);
    outline: 0;
}

.panel-content {
    flex: 1;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
}

/* Input fields */
#rule-pattern,
#event-json {
    width: 100%;
    padding: 0.8rem 1rem;
    background-color: var(--background-color);
    border: 1px solid var(--border-color-softer);
    border-radius: 4px;
    font-family: var(--mono);
    font-size: 1.3rem;
    color: var(--text-color-normal);
    resize: none;
    min-height: 4.5rem;
}

#rule-pattern:focus,
#event-json:focus {
    border: 1px solid var(--accent-color);
    outline: 0;
}

#rule-pattern::placeholder,
#event-json::placeholder {
    color: var(--text-color-softer);
}

/* Item lists */
#rules-list,
#events-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Items */
.item {
    background: var(--code-background);
    border: 1px solid var(--border-color-softer);
    border-radius: 4px;
    padding: 1rem 1.2rem;
}

.rule-item {
    border-left: 4px solid var(--accent-color);
}

.event-item {
    border-left: 4px solid var(--success-color);
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
}

.item-id {
    font-family: var(--mono);
    font-weight: 600;
    color: var(--text-color-richer);
    font-size: 1.2rem;
}

.item-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.item-time {
    color: var(--text-color-softer);
    font-family: var(--mono);
    font-size: 1.1rem;
}

.delete-btn {
    background: none;
    border: none;
    color: var(--error-color);
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    padding: 0 0.5rem;
    line-height: 1;
    border-radius: 4px;
}

.delete-btn:hover,
.delete-btn:focus {
    background: hsla(0, 65%, 51%, 0.1);
    outline: 0;
}

/* Inline edit textarea */
.inline-edit {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid transparent;
    border-radius: 4px;
    font-family: var(--mono);
    font-size: 1.3rem;
    background: transparent;
    color: var(--text-color-normal);
    resize: none;
    min-height: 3rem;
    line-height: 1;
    field-sizing: content;
}

.inline-edit:hover {
    background: var(--background-color);
}

.inline-edit:focus {
    border: 1px solid var(--accent-color);
    background: var(--background-color);
    outline: 0;
}

.inline-edit.invalid {
    border-color: var(--error-color);
    background: hsla(0, 65%, 51%, 0.05);
}

/* Match tags */
.item-matches {
    padding-top: 0.8rem;
    margin-top: 0.5rem;
    border-top: 1px solid var(--border-color-softer);
    min-height: 2.4rem;
    line-height: 1.8;
}

.match-tag {
    display: inline-block;
    background: var(--success-color);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    margin-right: 0.4rem;
    margin-bottom: 0.2rem;
    font-family: var(--mono);
    font-size: 1.1rem;
    font-weight: 500;
}

.no-match {
    color: var(--text-color-softer);
    font-style: italic;
    font-size: 1.2rem;
}

.error-inline {
    color: var(--error-color);
    font-size: 1.2rem;
}

/* Info placeholder */
.info {
    color: var(--text-color-softer);
    font-style: italic;
    text-align: center;
    padding: 1.5rem;
    font-size: 1.3rem;
}

/* Footer */
footer {
    text-align: center;
    padding: 1rem;
    background: var(--text-color-richer);
    color: var(--background-color);
    font-size: 1.2rem;
}

footer a {
    color: var(--accent-color);
}

footer a:hover {
    color: var(--accent-color-hover);
}

/* Visually hidden (for accessibility) */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Responsive */
@media (max-width: 600px) {
    main.container {
        grid-template-columns: 1fr;
    }

    header.header h1 {
        font-size: 2rem;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
    }
}
