/* styles.css - OS/2 Warp inspired theme for BIBle Gram version 2.0 */

/* Define OS/2 Warp color palette */
:root {
    --os2-purple: #663399; /* Classic OS/2 purple taskbar */
    --os2-purple-dark: #4d2673; /* Darker purple for depth */
    --os2-purple-light: #8855bb; /* Lighter purple for highlights */
    --os2-teal: #00A7A7; /* OS/2 Warp teal accent */
    --os2-teal-light: #00DCDC; /* Bright teal for highlights */
    --os2-gray: #C0C0C0; /* Classic gray background */
    --os2-dark-gray: #808080; /* Dark gray for borders */
    --os2-light-gray: #E8E8E8; /* Light gray for raised surfaces */
    --os2-white: #FFFFFF; /* White */
    --os2-black: #000000; /* Black text */
    --os2-button: #D4D0C8; /* Classic button color */
    --os2-yellow: #FFFF00; /* Yellow for highlights */
}

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

body {
    font-family: 'System', 'Arial', sans-serif;
    background-color: var(--os2-teal);
    background-image:
        linear-gradient(135deg, var(--os2-teal) 0%, var(--os2-teal-light) 100%);
    color: var(--os2-black);
    line-height: 1.4;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 1rem;
}

/* OS/2 Warp style header/taskbar */
h1 {
    color: var(--os2-white);
    background: linear-gradient(180deg, var(--os2-purple-light) 0%, var(--os2-purple) 50%, var(--os2-purple-dark) 100%);
    font-size: 1.5rem;
    padding: 0.6rem;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.3),
        inset 0 -1px 0 rgba(0,0,0,0.3),
        0 4px 8px rgba(0, 0, 0, 0.4);
    border-bottom: 2px solid var(--os2-purple-dark);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    font-weight: bold;
    margin-bottom: 0;
}

.header-link {
    color: var(--os2-teal-light);
    text-decoration: none;
    transition: color 0.2s ease;
}

.header-link:hover {
    color: var(--os2-yellow);
    text-decoration: underline;
}

.header-link:visited {
    color: var(--os2-teal-light);
}

/* Stats bar */
.stats-bar {
    background: linear-gradient(180deg, var(--os2-purple) 0%, var(--os2-purple-dark) 100%);
    color: var(--os2-white);
    padding: 0.4rem;
    text-align: center;
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    border-bottom: 2px solid var(--os2-purple-dark);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    position: sticky;
    top: 3.2rem;
    z-index: 999;
}

.stat-item {
    font-size: 0.9rem;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    cursor: help;
    padding: 0.2rem 0.5rem;
    background-color: rgba(0,0,0,0.2);
    border-radius: 3px;
    border: 1px solid rgba(255,255,255,0.2);
}

h2 {
    color: var(--os2-white);
    background: linear-gradient(180deg, var(--os2-purple-light) 0%, var(--os2-purple) 100%);
    font-size: 1.3rem;
    padding: 0.5rem;
    margin: 0;
    border-radius: 4px;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.3),
        0 2px 4px rgba(0, 0, 0, 0.3);
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}

/* Form styling with OS/2 3D bevel effect */
form {
    max-width: 100%;
    margin: 0.3rem;
    background-color: var(--os2-gray);
    padding: 0.8rem;
    border-radius: 0;
    box-shadow:
        inset 2px 2px 0 rgba(255,255,255,0.7),
        inset -2px -2px 0 rgba(0,0,0,0.5),
        2px 2px 8px rgba(0, 0, 0, 0.3);
    border: 2px solid var(--os2-dark-gray);
    flex-grow: 0;
}

label {
    color: var(--os2-black);
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
    display: block;
    font-weight: bold;
}

/* Form line layout (3 lines on desktop) */
.form-line {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.form-line > label:first-child {
    min-width: 100px;
    margin: 0;
}

.query-fields {
    display: flex;
    gap: 0.5rem;
    flex: 1;
    align-items: center;
    flex-wrap: wrap;
}

.field-inline {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.field-inline label {
    margin: 0;
    font-size: 1rem;
    white-space: nowrap;
}

.field-inline input,
.field-inline select {
    margin: 0;
    width: auto;
}

.field-inline input[type="number"] {
    width: 60px;
}

.field-inline select {
    min-width: 120px;
}

.radio-inline,
.checkbox-inline {
    display: inline-flex;
    align-items: center;
    margin-right: 1rem;
    margin-bottom: 0;
    font-weight: normal;
    gap: 0.3rem;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    flex: 1;
    max-width: 100%;
}

.translation-checkbox {
    white-space: nowrap;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    background-color: rgba(255,255,255,0.3);
    border-radius: 3px;
    transition: background-color 0.2s;
}

.translation-checkbox:hover {
    background-color: rgba(255,255,255,0.6);
}

.translation-abbrev {
    font-weight: bold;
    user-select: none;
}

input[type="text"],
input[type="number"],
select {
    width: 100%;
    padding: 0.4rem;
    margin-bottom: 0.4rem;
    border: 2px solid;
    border-color: var(--os2-dark-gray) var(--os2-light-gray) var(--os2-light-gray) var(--os2-dark-gray);
    background-color: var(--os2-white);
    color: var(--os2-black);
    font-size: 1rem;
    touch-action: manipulation;
    box-shadow: inset 1px 1px 3px rgba(0,0,0,0.2);
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
    outline: 2px dotted var(--os2-black);
    outline-offset: 2px;
}

input[type="radio"],
input[type="checkbox"] {
    margin-right: 0.75rem;
    width: 1.8rem;
    height: 1.8rem;
    accent-color: var(--os2-purple);
}

input[type="radio"] + label,
input[type="checkbox"] + label {
    display: inline-flex;
    align-items: center;
    color: var(--os2-black);
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
    touch-action: manipulation;
}

/* OS/2 style buttons */
input[type="submit"],
button {
    background: linear-gradient(180deg, var(--os2-light-gray) 0%, var(--os2-button) 50%, var(--os2-dark-gray) 100%);
    color: var(--os2-black);
    padding: 0.6rem;
    border: 2px solid;
    border-color: var(--os2-white) var(--os2-dark-gray) var(--os2-dark-gray) var(--os2-white);
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: bold;
    width: 100%;
    transition: all 0.1s ease;
    box-shadow:
        inset 1px 1px 0 rgba(255,255,255,0.8),
        inset -1px -1px 0 rgba(0,0,0,0.4),
        2px 2px 4px rgba(0,0,0,0.3);
    text-shadow: 1px 1px 0 rgba(255,255,255,0.6);
}

input[type="submit"]:hover,
button:hover {
    background: linear-gradient(180deg, var(--os2-white) 0%, var(--os2-light-gray) 50%, var(--os2-button) 100%);
}

input[type="submit"]:active,
button:active {
    border-color: var(--os2-dark-gray) var(--os2-white) var(--os2-white) var(--os2-dark-gray);
    box-shadow:
        inset -1px -1px 0 rgba(255,255,255,0.8),
        inset 1px 1px 2px rgba(0,0,0,0.4);
    transform: translate(1px, 1px);
}

.button-group {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.button-group button {
    width: auto;
    flex: 1;
    padding: 0.8rem;
    font-size: 1.2rem;
}

/* Results table with OS/2 styling */
.results-container {
    margin: 0.3rem;
    background-color: var(--os2-gray);
    border: 2px solid var(--os2-dark-gray);
    box-shadow:
        inset 2px 2px 0 rgba(255,255,255,0.7),
        inset -2px -2px 0 rgba(0,0,0,0.5),
        2px 2px 8px rgba(0, 0, 0, 0.3);
    padding: 0.5rem;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-controls {
    display: flex;
    gap: 0.3rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.filter-controls label {
    font-size: 1rem;
    margin: 0;
}

.filter-controls input[type="text"] {
    width: 200px;
    margin: 0;
    padding: 0.3rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--os2-white);
    border: 2px solid var(--os2-dark-gray);
    box-shadow: inset 1px 1px 0 rgba(0,0,0,0.1);
}

th, td {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--os2-dark-gray);
    text-align: left;
    font-size: 0.95rem;
}

th {
    background: linear-gradient(180deg, var(--os2-purple-light) 0%, var(--os2-purple) 100%);
    color: var(--os2-white);
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.3);
}

tr:nth-child(even) {
    background-color: var(--os2-light-gray);
}

tr:hover {
    background-color: var(--os2-teal-light);
    background-image: linear-gradient(90deg, transparent 0%, rgba(0,220,220,0.3) 50%, transparent 100%);
}

/* No results message */
p {
    margin: 0.3rem;
    font-size: 1rem;
    color: var(--os2-black);
    text-align: center;
    padding: 0.5rem;
    background-color: var(--os2-gray);
    border: 2px solid var(--os2-dark-gray);
    box-shadow: inset 2px 2px 0 rgba(255,255,255,0.7),
                inset -2px -2px 0 rgba(0,0,0,0.5);
}

/* Field groups */
.field-group {
    background-color: rgba(255,255,255,0.5);
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    border: 1px solid var(--os2-dark-gray);
    box-shadow: inset 1px 1px 0 rgba(255,255,255,0.7),
                inset -1px -1px 0 rgba(0,0,0,0.3);
}

/* Responsive design */
@media (min-width: 768px) {
    h1 {
        font-size: 1.8rem;
    }

    form {
        max-width: 50%;
        margin: 0.3rem auto;
    }

    .results-container {
        max-width: 98%;
        margin: 0.3rem auto;
    }

    th, td {
        font-size: 1rem;
    }
}

@media (min-width: 1024px) {
    h1 {
        font-size: 2rem;
    }

    form {
        max-width: 40%;
    }

    .results-container {
        max-width: 98%;
    }
}

/* Phone-specific adjustments */
@media (max-width: 480px) {
    body {
        font-size: 1rem;
    }

    h1 {
        font-size: 1.2rem;
        padding: 0.5rem;
    }

    .stats-bar {
        gap: 0.5rem;
        padding: 0.3rem;
        top: 2.5rem;
    }

    .stat-item {
        font-size: 0.75rem;
        padding: 0.15rem 0.3rem;
    }

    form {
        margin: 0.5rem;
        padding: 1rem;
    }

    /* Revert to vertical layout on mobile */
    .form-line {
        flex-direction: column;
        align-items: stretch;
    }

    .form-line > label:first-child {
        min-width: auto;
        margin-bottom: 0.3rem;
    }

    .query-fields {
        flex-direction: column;
        align-items: stretch;
    }

    .field-inline {
        flex-direction: column;
        align-items: stretch;
    }

    .field-inline label {
        margin-bottom: 0.2rem;
    }

    .field-inline input,
    .field-inline select {
        width: 100% !important;
    }

    .checkbox-group {
        flex-wrap: wrap;
    }

    .radio-inline,
    .checkbox-inline {
        margin-bottom: 0.5rem;
    }

    .translation-checkbox {
        flex: 0 0 auto;
    }

    input[type="text"],
    input[type="number"],
    select {
        font-size: 1rem;
        padding: 0.6rem;
        width: 100%;
    }

    input[type="radio"],
    input[type="checkbox"] {
        width: 1.4rem;
        height: 1.4rem;
    }

    input[type="submit"],
    button {
        padding: 0.9rem;
        font-size: 1.2rem;
    }

    .results-container {
        margin: 0.5rem;
        padding: 0.5rem;
    }

    table {
        font-size: 0.95rem;
        display: block;
        overflow-x: auto;
    }

    th, td {
        padding: 0.6rem;
    }

    .filter-controls {
        width: 100%;
    }

    .filter-controls input[type="text"] {
        width: 100%;
    }

    .button-group {
        flex-direction: column;
    }
}

/* Hide verse/keyword fields toggle animation */
#verse_fields, #keyword_fields {
    transition: opacity 0.3s ease, max-height 0.3s ease;
    overflow: hidden;
}

#verse_fields[style*="display: none"],
#keyword_fields[style*="display: none"] {
    opacity: 0;
    max-height: 0;
}

#verse_fields[style*="display: block"],
#keyword_fields[style*="display: block"] {
    opacity: 1;
    max-height: 1000px;
}

/* Result count badge */
.result-count {
    background: linear-gradient(180deg, var(--os2-teal-light) 0%, var(--os2-teal) 100%);
    color: var(--os2-black);
    padding: 0.5rem 1rem;
    border: 2px solid;
    border-color: var(--os2-white) var(--os2-dark-gray) var(--os2-dark-gray) var(--os2-white);
    box-shadow: inset 1px 1px 0 rgba(255,255,255,0.5);
    font-weight: bold;
    border-radius: 4px;
}

/* Loading state */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Notes Panel (Desktop Only) */
.notes-panel {
    display: none; /* Hidden by default, shown on desktop */
    position: fixed;
    right: 1rem;
    top: 6rem;
    width: 300px;
    background-color: var(--os2-gray);
    border: 2px solid var(--os2-dark-gray);
    box-shadow:
        inset 2px 2px 0 rgba(255,255,255,0.7),
        inset -2px -2px 0 rgba(0,0,0,0.5),
        4px 4px 12px rgba(0, 0, 0, 0.4);
    z-index: 998;
}

.notes-header {
    background: linear-gradient(180deg, var(--os2-purple-light) 0%, var(--os2-purple) 100%);
    color: var(--os2-white);
    padding: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--os2-purple-dark);
    cursor: grab;
    user-select: none;
}

.notes-header:active {
    cursor: grabbing;
}

.drag-icon {
    font-size: 1.2rem;
    margin-right: 0.3rem;
    opacity: 0.7;
    letter-spacing: -2px;
}

.notes-header h3 {
    margin: 0;
    font-size: 1rem;
    background: none;
    box-shadow: none;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    padding: 0;
    flex: 1;
}

.notes-buttons {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.notes-download-btn,
.notes-save-btn {
    padding: 0.3rem 0.6rem !important;
    font-size: 0.85rem !important;
    width: auto !important;
    margin: 0;
}

.notes-save-btn {
    background: linear-gradient(180deg, #90EE90 0%, #50C850 50%, #308030 100%) !important;
}

.notes-save-btn:hover {
    background: linear-gradient(180deg, #B0FFB0 0%, #70E870 50%, #50A050 100%) !important;
}

#notesTextarea {
    width: 100%;
    height: 400px;
    padding: 0.5rem;
    border: none;
    border-top: 2px solid var(--os2-dark-gray);
    background-color: var(--os2-white);
    color: var(--os2-black);
    font-family: 'System', 'Arial', monospace;
    font-size: 0.95rem;
    resize: vertical;
    min-height: 200px;
    max-height: 600px;
    box-shadow: inset 1px 1px 3px rgba(0,0,0,0.2);
}

#notesTextarea:focus {
    outline: 2px dotted var(--os2-purple);
    outline-offset: -2px;
}

.notes-footer {
    padding: 0.4rem;
    background: linear-gradient(180deg, var(--os2-button) 0%, var(--os2-gray) 100%);
    border-top: 2px solid var(--os2-dark-gray);
    text-align: center;
}

.notes-link {
    color: var(--os2-purple);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: bold;
    transition: color 0.2s ease;
}

.notes-link:hover {
    color: var(--os2-teal);
    text-decoration: underline;
}

.notes-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    cursor: nwse-resize;
    background: linear-gradient(135deg, transparent 50%, var(--os2-dark-gray) 50%);
    border-top: 2px solid var(--os2-white);
    border-left: 2px solid var(--os2-white);
}

.notes-resize-handle:hover {
    background: linear-gradient(135deg, transparent 50%, var(--os2-purple) 50%);
}

/* Show notes panel on desktop */
@media (min-width: 1024px) {
    .notes-panel {
        display: block;
    }

    .results-container {
        margin-right: 320px; /* Make room for notes panel */
    }
}

/* Adjust for very large screens */
@media (min-width: 1400px) {
    .notes-panel {
        width: 350px;
    }

    .results-container {
        margin-right: 370px;
    }
}
