:root {
    --white: #ffffff;
    --light-off-white: #f9f9f9;
    --lighter-gray: #e0e0e0;
    --charcoal: #333333;
    
    --lighter-bg: #ffffff;
    --panel-bg: #ffffff;
    --border-color: #e2e8f3;
    --text-primary: #1a2942;
    --text-secondary: #364b51;
    --accent-primary: #c4a853;
    --accent-hover: #b39440;
    --highlight: #d4bc6c;
    --blue-accent: #234876;
    --blue-hover: #2c5991;
    --input-bg: #ffffff;
    
    --success: #10B981;
    --warning: #F59E0B;
    --error: #CC0000;
    --darker-red: #b02a37;
    --info: #3B82F6;
    
    --dark-bg: #14151a;
    --darker-bg: #0f1012;
    --dark-panel-bg: #1c1e24;
    --dark-border-color: #3e464d;
    --dark-border-color-lighter: #52565d;
    --dark-text-primary: #dfdfdf;
    --dark-text-secondary: #d0d3d9;
    --dark-accent-primary: #b39440;
    --dark-accent-hover: #ceb05f;
    --dark-highlight: #e2ca8b;
    --dark-input-bg: #272a33;
    --dark-scrollbar-thumb: #4a4f5a;
    --dark-scrollbar-track: #1f2228;
    
    --dark-success: #059669;
    --dark-warning: #D97706;
    --dark-error: #DC2626;
    --dark-info: #2563EB;
    
    --shadow-sm: 0 2px 8px rgba(23, 43, 77, 0.05);
    --shadow-md: 0 4px 16px rgba(23, 43, 77, 0.08);
    --shadow-lg: 0 8px 24px rgba(23, 43, 77, 0.1);
    --focus-ring: rgba(196, 168, 83, 0.25);
    --dark-focus-ring: rgba(179, 152, 80, 0.4);
    
    --transition-fast: 150ms;
    --transition-normal: 250ms;
    --transition-slow: 350ms;
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-out: cubic-bezier(0, 0, 0.2, 1);
    --ease-in: cubic-bezier(0.4, 0, 1, 1);
}

body {
    margin: 0;
    min-height: 100vh;
    background-color: var(--light-off-white);
    color: var(--text-primary);
}

p {
    margin-bottom: initial;
}

h1, h2 {
    margin: 0;
}

h2,
h3 {
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.links-area {
    margin: 0 3rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

#panelsContainer {
    display: flex;
    flex-direction: column;
    min-height: 90vh;
    padding: 0px 4px;
}

#searchContainer {
    display: flex;
}

#optionPanel {
    width: 250px;
    padding: 20px;
    border-radius: 2px;
    background-color: var(--panel-bg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal) var(--ease-out);
    position: sticky;
    top: 0;
    max-height: calc(100vh - 20px);
    overflow-y: auto;
    height: fit-content;
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

#optionPanel:hover {
    box-shadow: var(--shadow-md);
}

#configuration {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

#optionPanel h2 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

#optionPanel h3 {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.search-field {
    margin-bottom: 0.5rem;
}

.search-field input {
    --border-size: 2px;
    --padding-horizontal: 14px;
    width: calc(100% - var(--border-size) * 2 - var(--padding-horizontal) * 2);
    padding: 12px var(--padding-horizontal);
    font-size: .9em;
    background-color: var(--input-bg);
    border: var(--border-size) solid var(--border-color);
    color: var(--text-primary);
    border-radius: 6px;
    transition: all var(--transition-normal) var(--ease-out);
}

.search-field input:hover {
    border-color: var(--accent-primary);
}

.search-field input:focus {
    border-color: var(--accent-primary);
    box-shadow: var(--focus-ring);
    outline: none;
}

.options {
    color: var(--text-secondary);
    margin-bottom: 0;
    padding: 0.5rem;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.03);
}

.options-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.switch-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.5rem;
}

.options h3 {
    font-size: 0.95em;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.options label {
    display: flex;
    flex-direction: row;
    gap: .3rem;
    font-size: 0.9em;
    padding: 0.25rem 0;
    margin: 0;
    cursor: pointer;
    transition: color var(--transition-fast) var(--ease-out);
    align-items: flex-end;
}

.options label:hover {
    color: var(--text-primary);
}

.options input[type="checkbox"] {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--input-bg);
    cursor: pointer;
    transition: all var(--transition-normal) var(--ease-out);
    position: relative;
}

.dark .options input[type="checkbox"] {
    border: 2px solid var(--dark-border-color);
    background-color: var(--dark-input-bg);
}

.options input[type="checkbox"]:checked {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.dark .options input[type="checkbox"]:checked {
    background-color: var(--dark-accent-primary);
    border-color: var(--dark-accent-primary);
}

.options input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    color: white;
    font-size: 12px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.options input[type="checkbox"]:hover {
    border-color: var(--accent-primary);
}

.dark .options input[type="checkbox"]:hover {
    border-color: var(--dark-accent-primary);
}

.search-btn {
    padding: 12px;
    margin-top: 10px;
    width: 100%;
    border: none;
    font-size: 1em;
    cursor: pointer;
    background-color: var(--accent-primary);
    color: #ffffff;
    border-radius: 6px;
    transition: all var(--transition-normal) var(--ease-out);
}

.search-btn:hover:enabled {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(147, 124, 67, 0.2);
}

.search-btn:active:enabled {
    transform: translateY(0);
}

.search-btn.red {
    background-color: var(--error);
}

.search-btn:disabled {
    background-color: var(--lighter-gray);
    color: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.7;
}

.search-btn.red:enabled:hover {
    background-color: var(--darker-red);
}

.content {
    flex: 1;
    padding-left: 10px;
    min-width: 200px;
}

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

.result {
    background-color: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal) var(--ease-out);
    padding: 1rem;
    position: relative;
}

.result:not(.placeholder) {
    border-left: 4px solid transparent !important;
}

.result:not(.placeholder):hover {
    box-shadow: var(--shadow-md);
}

.result[data-type="en"] {
    border-left-color: #1565c0 !important;
}

.result[data-type="pli"] {
    border-left-color: #2e7d32 !important;
}

.result[data-type="com"] {
    border-left-color: var(--dark-orange) !important;
}

.result[data-type]::after {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 3px;
    font-family: 'RobotoSerif Medium';
	transition: background var(--transition-normal) var(--ease-out);
}

.result[data-type="en"]::after {
    content: "English";
    background: #e3f2fdcc;
    color: #1565c0;
}

.result[data-type="en"]:hover::after{
	background: #e3f2fde5;
}

.result[data-type="pli"]::after {
    content: "Pāli";
    background: #e8f5e9cc;
    color: #2e7d32;
}

.result[data-type="pli"]:hover::after{
	background: #e8f5e9e5;
}

.result[data-type="com"]::after {
    content: "Comment";
    background: #fff3e0cc;
    color: var(--dark-orange) !important;
}

.result[data-type="com"]:hover::after{
	background: #fff3e0e5;
}

.result.placeholder h1 {
    font-size: 1.5rem;
}

.result a {
    text-decoration: none;
    color: inherit;
}

.result h3 {
    font-size: 1.2em;
    margin-bottom: .5rem;
    color: var(--text-secondary);
    transition: color var(--transition-normal) var(--ease-out);
}

.result:hover h3 {
    color: var(--text-primary);
}

.result p {
    line-height: 1.5;
    color: var(--text-secondary);
    font-size: 0.95em;
	transition: color var(--transition-normal) var(--ease-out);
}

.result:hover p {
    color: var(--text-primary);
}

.result.placeholder p {
    color: var(--text-primary);
}

b {
    font-family: "RobotoSerif Bold";
    font-weight: normal;
    color: var(--accent-primary);
    transition: color var(--transition-normal) var(--ease-out);
}

.result:hover b {
    color: var(--accent-hover);
}

.result.placeholder b {
	font-family: 'RobotoSerif Medium';
    color: var(--accent-hover);
}

.loading-bar-container {
    width: 100%;
    position: relative;
    height: .3rem;
    background-color: var(--light-off-white);
    overflow: hidden;
}

.loading-bar {
    height: 100%;
    width: 0;
    background: var(--accent-primary);
    background-size: 200% 100%;
    animation: loading-animation 2s linear infinite;
    position: relative;
    overflow: hidden;
}

.loading-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: -150%;
    width: 150%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    animation: shine 3s ease-in-out infinite;
}

@keyframes loading-animation {
    0% { background-position: 100% 0%; }
    100% { background-position: -100% 0%; }
}

@keyframes shine {
    0% { left: -150%; }
    100% { left: 150%; }
}

#optionPanel::-webkit-scrollbar {
    width: 6px;
}

#optionPanel::-webkit-scrollbar-track {
    background: #f1f3f7;
    border-radius: 4px;
}

#optionPanel::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

#optionPanel::-webkit-scrollbar-thumb:hover {
    background: var(--accent-hover);
}

.mobile-search-panel-button {
    top: 55px !important;
    display: none;
    position: fixed;
    top: .4rem;
    left: 50%;
    transform: translateX(-50%);
    font-family: "RobotoSerif Medium";
    border-radius: 20px;
    color: var(--text-primary);
    z-index: 1000;
    cursor: pointer;
    padding: 10px 16px;
    background-color: var(--panel-bg);
    border: 2px solid var(--border-color);
    transition: all var(--transition-normal) var(--ease-out);
    box-shadow: var(--shadow-sm);
}

.dark .mobile-search-panel-button {
    background-color: var(--dark-panel-bg);
    border: 2px solid var(--dark-border-color-lighter);
    color: var(--dark-text-primary);
}

.mobile-search-panel-button:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    box-shadow: var(--shadow-md);
}

.mobile-search-panel-button::after {
    content: "▼";
    margin-left: 8px;
}

.mobile-search-panel-button.open {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.mobile-search-panel-button.open::after {
    content: "▲";
}

.dark body {
    background-color: var(--dark-bg);
    color: var(--dark-text-primary);
}

.dark #optionPanel {
    background-color: var(--dark-panel-bg);
    border-color: var(--dark-border-color);
}

.dark .options {
    background: rgba(255, 255, 255, 0.03);
}

.dark .options h3,
.dark .options label {
    color: var(--dark-text-secondary);
}

.dark .options label:hover {
    color: var(--dark-text-primary);
}

.dark .search-field input {
    background-color: var(--dark-input-bg);
    border-color: var(--dark-border-color);
    color: var(--dark-text-primary);
}

.dark .search-field input:hover {
    border-color: var(--dark-accent-hover);
}

.dark .search-field input:focus {
    border-color: var(--dark-accent-hover);
    box-shadow: var(--dark-focus-ring);
}


.dark .search-btn.red:hover:enabled {
    background-color: var(--error);
    box-shadow: 0 4px 12px rgba(204, 0, 0, 0.5);
}

.dark .search-btn {
    background-color: var(--dark-accent-primary);
}

.dark .search-btn:hover:enabled {
    background-color: var(--dark-accent-hover);
    box-shadow: 0 4px 12px rgba(179, 152, 80, 0.3);
}

.dark .search-btn:disabled {
    background-color: var(--dark-border-color);
    color: var(--dark-text-secondary);
}

.dark .result {
    background-color: var(--dark-panel-bg);
    border-color: var(--dark-border-color);
}

.dark .result h3{
	color: var(--dark-text-secondary);
}

.dark .result:hover h3{
	color: var(--dark-text-primary);
}

.dark .result p {
    color: var(--dark-text-secondary);
}

.dark .result.placeholder p {
    color: var(--dark-text-primary);
}

.dark .result:hover p{
	color: var(--dark-text-primary);
}

.dark b {
    color: var(--dark-accent-primary);
}

.dark .result:hover b {
    color: var(--dark-accent-hover);
}

.dark .result.placeholder b {
    color: var(--dark-accent-hover);
}

.dark .loading-bar-container {
    background-color: var(--darker-bg);
}

.dark #optionPanel::-webkit-scrollbar-track {
    background: var(--dark-scrollbar-track);
}

.dark #optionPanel::-webkit-scrollbar-thumb {
    background: var(--dark-scrollbar-thumb);
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

@media (max-width: 768px) {
    .links-area {
        margin: 0 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    #panelsContainer {
        padding: 3px;
        top: 55px;
        position: relative;
    }

    #searchContainer {
        flex-direction: column;
    }

    #optionPanel {
        width: 100%;
        padding: 0.75rem;
        position: fixed;
        top: -100%;
        left: .5%;
        width: 99%;
        z-index: 999;
        transition: top var(--transition-normal) var(--ease-out);
    }

    #optionPanel.open {
        top: 2.8rem;
        max-height: 85vh;
        overflow-y: auto;
    }

    .mobile-search-panel-button {
        display: block;
        padding: .5rem;
		width: 10rem;
		font-size: .9rem;
    }
	
	.dark .mobile-search-panel-button.open{
		background-color: var(--dark-accent-primary);
		border-color: var(--dark-accent-primary);
	}
	
	.dark .search-btn {
		background-color: var(--dark-accent-primary);
	}

    .content {
        padding: 0;
        margin-top: 1rem;
    }

    .result {
        padding: 0.75rem;
    }

    .result h3 {
        margin-right: 75px;
        font-size: 1em;
    }

    .options {
        padding: 0.35rem;
    }

    .options h3 {
        font-size: 0.8rem;
        margin-bottom: 0.15rem;
    }

    .options label {
        font-size: 0.8rem;
        padding: 0.15rem 0;
        align-items: center;
		justify-content: center;
    }
	
	#optionPanel{
		border-width: 2px;
	}
	
	#optionPanel h2,
	#optionPanel h3{
		text-align: center;
	}

    .switch-options {
        grid-template-columns: repeat(3, 1fr);
    }

    .options input[type="checkbox"] {
        width: 20px;
        height: 20px;
    }

    #langOption label,
    #bookOption label {
        display: grid;
        gap: 0.5em;
        align-items: center;
    }
	
	#bookOption label{
		grid-template-columns: auto 1em;
	}
	
	#langOption label{
		grid-template-columns: auto 2em;
	}
	
	#langOption .labels-container,
	#bookOption .labels-container {
		display: grid;
		gap: 0.25em;
	}
	
	#langOption .labels-container,
	.options-group{
		grid-template-columns: repeat(2, 1fr);
	}
	
	#bookOption .labels-container{
		grid-template-columns: repeat(3, 1fr);
	}
	
	.options-group .labels-container label {
        display: grid;
        grid-template-columns: auto 1fr;
        gap: 0.5em;
        align-items: center;
    }

    .search-field input {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .result h3 {
        margin-right: 65px;
    }
	
	#langOption label{
		grid-template-columns: auto 4em;
	}

	#langOption .labels-container{
		grid-template-columns: repeat(1, 1fr);
	}

	#bookOption .labels-container,
    .switch-options {
        grid-template-columns: repeat(2, 1fr);
    }

    .options {
        padding: 0.25rem;
    }
	
    #optionsPanel h3 {
        text-align: center;
    }

    .search-btn {
        padding: 10px;
    }

    .result[data-type]::after {
        font-size: 0.65rem;
        padding: 1px 6px;
    }
}

@supports (-webkit-touch-callout: none) {
    .search-field input,
    .search-btn,
    .mobile-search-panel-button {
        font-size: 16px;
    }
}

@media (forced-colors: active) {
    .result,
    .search-btn,
    .mobile-search-panel-button,
    .options input[type="checkbox"] {
        border: 1px solid CanvasText;
    }
}
