/* ============================================================
   qhErpmini application theme
   Applies only to the outer shell, login background, and actions.
   Internal forms/data surfaces stay neutral.
   ============================================================ */

:root,
html[data-app-theme="current"] {
    --app-theme-start: #0250c5;
    --app-theme-end: #d43f8d;
    --app-sidebar-start: #0061af;
    --app-sidebar-end: #222d32;
    --app-accent: #d43f8d;
    --app-accent-dark: #a62d6d;
    --app-accent-soft: #fce7f3;
    --app-accent-glow: rgba(212, 63, 141, 0.32);
    --app-shell-bg: #ecf0f5;
}

html[data-app-theme="navy"] {
    --app-theme-start: #061a40;
    --app-theme-end: #0f3d74;
    --app-sidebar-start: #08203f;
    --app-sidebar-end: #111827;
    --app-accent: #0f3d74;
    --app-accent-dark: #061a40;
    --app-accent-soft: #dbeafe;
    --app-accent-glow: rgba(15, 61, 116, 0.32);
}

html[data-app-theme="purple"] {
    --app-theme-start: #4c1d95;
    --app-theme-end: #7e22ce;
    --app-sidebar-start: #4c1d95;
    --app-sidebar-end: #1f1636;
    --app-accent: #7e22ce;
    --app-accent-dark: #581c87;
    --app-accent-soft: #f3e8ff;
    --app-accent-glow: rgba(126, 34, 206, 0.32);
}

html[data-app-theme="red"] {
    --app-theme-start: #7f1d1d;
    --app-theme-end: #dc2626;
    --app-sidebar-start: #7f1d1d;
    --app-sidebar-end: #1f1f24;
    --app-accent: #dc2626;
    --app-accent-dark: #991b1b;
    --app-accent-soft: #fee2e2;
    --app-accent-glow: rgba(220, 38, 38, 0.30);
}

html[data-app-theme="green"] {
    --app-theme-start: #064e3b;
    --app-theme-end: #16a34a;
    --app-sidebar-start: #065f46;
    --app-sidebar-end: #17251f;
    --app-accent: #16a34a;
    --app-accent-dark: #047857;
    --app-accent-soft: #dcfce7;
    --app-accent-glow: rgba(22, 163, 74, 0.30);
}

/* Login page */
html[data-app-theme] .container-login100 {
    background: var(--app-theme-start);
    background: -webkit-linear-gradient(bottom, var(--app-theme-start), var(--app-theme-end));
    background: -o-linear-gradient(bottom, var(--app-theme-start), var(--app-theme-end));
    background: -moz-linear-gradient(bottom, var(--app-theme-start), var(--app-theme-end));
    background: linear-gradient(to top, var(--app-theme-start), var(--app-theme-end));
    transition: background 0.3s ease;
}

html[data-app-theme] .login100-form-btn {
    background: var(--app-accent) !important;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
}

html[data-app-theme] .login100-form-btn:hover,
html[data-app-theme] .login100-form-btn:focus {
    background: var(--app-accent-dark) !important;
}

html[data-app-theme] .focus-input100 {
    color: var(--app-accent-glow);
}

html[data-app-theme] .input100:focus + .focus-input100 + .symbol-input100,
html[data-app-theme] .hov1:hover {
    color: var(--app-accent);
    border-color: var(--app-accent);
}

.theme-picker {
    width: 100%;
    margin: 0 0 18px;
    padding: 12px;
    direction: rtl;
    text-align: right;
    background: rgba(255, 255, 255, 0.74);
    border: 1px solid rgba(31, 41, 55, 0.08);
    border-radius: 8px;
}

.theme-picker.theme-picker-compact {
    margin: 18px 0 0;
    padding: 14px;
    background: rgba(255, 255, 255, 0.58);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.theme-picker-title {
    display: block;
    margin-bottom: 10px;
    color: #374151;
    font-size: 13px;
    font-weight: 700;
}

.theme-picker-compact .theme-picker-title {
    font-size: 13px;
    margin-bottom: 10px;
}

.theme-options {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
}

.theme-options.theme-options-rows {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.theme-option {
    min-height: 44px;
    padding: 7px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    color: #374151;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.theme-option.theme-option-row {
    min-height: 52px;
    padding: 8px 10px;
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
    text-align: right;
    font-size: 12px;
    border-color: rgba(209, 213, 219, 0.92);
    background: rgba(255, 255, 255, 0.94);
}

.theme-option.theme-option-row span:last-child {
    min-width: 0;
    white-space: nowrap;
}

.theme-option.theme-option-row .theme-swatch {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
}

.theme-option:hover,
.theme-option:focus {
    border-color: var(--app-accent);
    box-shadow: 0 0 0 4px var(--app-accent-soft);
    outline: none;
}

.theme-option.is-active,
.theme-option[aria-pressed="true"] {
    border-color: var(--app-accent);
    box-shadow: 0 0 0 3px var(--app-accent-soft);
    transform: translateY(-1px);
}

.theme-option.theme-option-row.is-active,
.theme-option.theme-option-row[aria-pressed="true"] {
    background: #fff;
    color: #111827;
}

.theme-swatch {
    width: 24px;
    height: 24px;
    display: block;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.85);
    box-shadow: 0 0 0 1px rgba(31, 41, 55, 0.16);
}

.theme-swatch.theme-navy {
    background: linear-gradient(135deg, #061a40, #0f3d74);
}

.theme-swatch.theme-purple {
    background: linear-gradient(135deg, #4c1d95, #7e22ce);
}

.theme-swatch.theme-current {
    background: linear-gradient(135deg, #0250c5, #d43f8d);
}

.theme-swatch.theme-red {
    background: linear-gradient(135deg, #7f1d1d, #dc2626);
}

.theme-swatch.theme-green {
    background: linear-gradient(135deg, #064e3b, #16a34a);
}

@media (max-width: 420px) {
    .theme-options {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .theme-options.theme-options-rows {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Application shell */
html[data-app-theme] body.skin-blue .main-header .navbar {
    background: var(--app-theme-start) !important;
    background: linear-gradient(to left, var(--app-theme-start) 0%, var(--app-theme-end) 100%) !important;
    transition: background 0.3s ease;
}

html[data-app-theme] body.skin-blue .main-header .logo,
html[data-app-theme] body.skin-blue .main-header li.user-header {
    background: var(--app-theme-start) !important;
}

html[data-app-theme] body.skin-blue .main-header .logo:hover,
html[data-app-theme] body.skin-blue .main-header .navbar .sidebar-toggle:hover,
html[data-app-theme] body.skin-blue .main-header .navbar .dropdown-menu li a:hover {
    background: rgba(0, 0, 0, 0.18) !important;
}

html[data-app-theme] body.skin-blue .main-sidebar,
html[data-app-theme] body.skin-blue .left-side {
    background: var(--app-sidebar-end) !important;
    background: linear-gradient(to bottom, var(--app-sidebar-start) 0%, var(--app-sidebar-end) 100%) !important;
}

html[data-app-theme] body.skin-blue .wrapper {
    background: var(--app-sidebar-end) !important;
}

html[data-app-theme] body.skin-blue .content-wrapper,
html[data-app-theme] body.skin-blue .right-side {
    background: var(--app-shell-bg) !important;
}

html[data-app-theme] body.skin-blue .sidebar-menu > li:hover > a,
html[data-app-theme] body.skin-blue .sidebar-menu > li.active > a,
html[data-app-theme] body.skin-blue .sidebar-menu > li.menu-open > a {
    background: rgba(255, 255, 255, 0.10) !important;
}

html[data-app-theme] body.skin-blue .sidebar-menu > li.active > a {
    border-left-color: var(--app-accent) !important;
}

html[data-app-theme] body.skin-blue .sidebar-menu .treeview-menu > li.active > a,
html[data-app-theme] body.skin-blue .sidebar-menu .treeview-menu > li > a:hover {
    background-color: var(--app-accent) !important;
    color: #fff !important;
}

/* Action colors only; data-entry surfaces keep their own backgrounds. */
html[data-app-theme] body.skin-blue input[type="submit"],
html[data-app-theme] body.skin-blue input[type="button"],
html[data-app-theme] body.skin-blue button,
html[data-app-theme] body.skin-blue .btn-primary {
    background-color: var(--app-accent);
    border-color: var(--app-accent-dark);
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

html[data-app-theme] body.skin-blue input[type="submit"]:hover,
html[data-app-theme] body.skin-blue input[type="button"]:hover,
html[data-app-theme] body.skin-blue button:hover,
html[data-app-theme] body.skin-blue .btn-primary:hover,
html[data-app-theme] body.skin-blue input[type="submit"]:focus,
html[data-app-theme] body.skin-blue input[type="button"]:focus,
html[data-app-theme] body.skin-blue button:focus,
html[data-app-theme] body.skin-blue .btn-primary:focus {
    background-color: var(--app-accent-dark);
    border-color: var(--app-accent-dark);
}

html[data-app-theme] body.skin-blue input[type="text"]:focus,
html[data-app-theme] body.skin-blue input[type="password"]:focus,
html[data-app-theme] body.skin-blue select:focus,
html[data-app-theme] body.skin-blue textarea:focus {
    border-color: var(--app-accent) !important;
    box-shadow: 0 0 0 3px var(--app-accent-soft);
}

html[data-app-theme] body.skin-blue .grid-view th {
    background-color: #1f2937;
}
