﻿@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@300;400;500;600;700&display=swap');

:root {
    --thb-primary-rgb: 74, 11, 13; /* #4A0B0D Themis Bordosu */
    --thb-secondary-rgb: 96, 15, 17; /* #600F11 Derin Bordo */
    --thb-text-rgb: 33, 33, 33; /* #212121 Metin Siyahi */
}

/* Theme bridge: Tailwind utility classes use dynamic banner-derived colors */
.bg-primary {
    background-color: rgb(var(--thb-primary-rgb)) !important;
}
.text-primary {
    color: rgb(var(--thb-primary-rgb)) !important;
}
.border-primary {
    border-color: rgb(var(--thb-primary-rgb)) !important;
}
.bg-secondary {
    background-color: rgb(var(--thb-secondary-rgb)) !important;
}
.bg-primary\/10 {
    background-color: rgba(var(--thb-primary-rgb), 0.10) !important;
}
.bg-primary\/5 {
    background-color: rgba(var(--thb-primary-rgb), 0.05) !important;
}
.border-primary\/10 {
    border-color: rgba(var(--thb-primary-rgb), 0.10) !important;
}
.hover\:text-primary:hover {
    color: rgb(var(--thb-primary-rgb)) !important;
}
.hover\:bg-primary:hover {
    background-color: rgba(var(--thb-primary-rgb), 0.92) !important;
}
.hover\:bg-secondary:hover {
    background-color: rgb(var(--thb-secondary-rgb)) !important;
}
.focus\:border-primary:focus {
    border-color: rgb(var(--thb-primary-rgb)) !important;
}
.focus\:ring-primary:focus {
    --tw-ring-color: rgba(var(--thb-primary-rgb), 0.35) !important;
}
.focus\:ring-primary\/10:focus {
    --tw-ring-color: rgba(var(--thb-primary-rgb), 0.10) !important;
}

/* Global Reset & Base Styles */
body {
    font-family: 'Quicksand', sans-serif;
    -webkit-font-smoothing: antialiased;
    color: rgb(var(--thb-text-rgb));
    overflow-x: hidden;
}

/* Prevent long uninterrupted text from pushing layout on mobile. */
.wrap-anywhere {
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Modern checkbox style */
input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 1.1rem;
    height: 1.1rem;
    border: 1.5px solid #cbd5e1;
    border-radius: 0.45rem;
    background: #ffffff;
    display: inline-grid;
    place-content: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
}

input[type="checkbox"]::after {
    content: '';
    width: 0.52rem;
    height: 0.32rem;
    border: 2px solid #ffffff;
    border-top: 0;
    border-right: 0;
    transform: rotate(-45deg) scale(0);
    transform-origin: center;
    transition: transform 0.18s ease;
    margin-top: -1px;
}

input[type="checkbox"]:checked {
    background: rgb(var(--thb-primary-rgb));
    border-color: rgb(var(--thb-primary-rgb));
    box-shadow: 0 0 0 4px rgba(var(--thb-primary-rgb), 0.12);
}

input[type="checkbox"]:checked::after {
    transform: rotate(-45deg) scale(1);
}

input[type="checkbox"]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(var(--thb-primary-rgb), 0.18);
}

input[type="checkbox"]:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.app-checkbox-wrap {
    width: 100%;
    min-height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.table-checkbox {
    margin: 0;
    line-height: 1;
    vertical-align: middle;
}

.table-checkbox::after {
    margin-top: 0;
}

/* Mobile: bigger checkboxes for easier tapping */
@media (max-width: 640px) {
    input[type="checkbox"] {
        width: 1.35rem;
        height: 1.35rem;
        border-radius: 0.5rem;
    }
    input[type="checkbox"]::after {
        width: 0.6rem;
        height: 0.38rem;
        border-width: 2.5px;
    }
}

/* Photo banners: prefer crisp resampling on high-DPI screens */
.banner-image-crisp {
    image-rendering: auto;
    image-rendering: -webkit-optimize-contrast;
    backface-visibility: hidden;
    transform: translateZ(0);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* --- Mandatory Custom Dropdown Styles --- */
.custom-dropdown {
    position: relative;
    width: 100%;
}

.dropdown-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: white;
    border: 1px solid #e2e8f0; /* slate-200 */
    border-radius: 0.75rem; /* rounded-xl matches new design */
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.dropdown-btn:hover {
    border-color: #cbd5e1; /* slate-300 */
}

.dropdown-btn.active {
    border-color: #4A0B0D; /* primary */
    box-shadow: 0 0 0 3px rgba(74, 11, 13, 0.1);
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 110%;
    left: 0;
    width: 100%;
    background-color: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    z-index: 50;
    overflow: hidden;
    animation: slideDown 0.2s ease-out forwards;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.dropdown-content.show {
    display: block;
}

.dropdown-search-container {
    padding: 0.75rem;
    border-bottom: 1px solid #f1f5f9;
}

.dropdown-search {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    outline: none;
    font-size: 0.9rem;
    color: #475569;
}

.dropdown-search:focus {
    border-color: #4A0B0D;
}

.dropdown-options {
    max-height: 200px;
    overflow-y: auto;
}

.dropdown-option {
    padding: 0.75rem 1rem;
    cursor: pointer;
    color: #475569;
    transition: background-color 0.1s;
}

.dropdown-option:hover {
    background-color: #f8fafc;
    color: #4A0B0D;
}

/* Accordion Animation */
.accordion-content {
    transition: max-height 0.3s ease-in-out, opacity 0.3s ease-in-out;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

.accordion-content.active {
    opacity: 1;
}

/* --- INLINE TOAST NOTIFICATIONS (auth pages) --- */
@keyframes inlineToastIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes inlineToastOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-6px); }
}

/* --- FIXED TOAST NOTIFICATIONS (all other pages) --- */
@keyframes fixedToastIn {
    from { opacity: 0; transform: translateY(1rem); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fixedToastOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(1rem); }
}

/* --- CUSTOM CONFIRM MODAL --- */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.confirm-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.confirm-box {
    background: white;
    padding: 2rem;
    border-radius: 1.5rem;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: scale(0.95);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    text-align: center;
}

.confirm-overlay.open .confirm-box {
    transform: scale(1);
}

/* --- MODERN FORM VALIDATION STYLES --- */
.input-error {
    /* Marker class: visual styles are applied to concrete controls below. */
}

input.input-error,
textarea.input-error,
select.input-error,
.relative.input-error > input,
.relative.input-error > textarea,
.relative.input-error > select,
.pw-toggle-wrap.input-error > input,
.dropdown-btn.input-error {
    border-color: #ef4444 !important; /* Red-500 */
    background-color: #fef2f2 !important; /* Red-50 */
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1) !important;
    animation: errorPulse 0.25s ease-out;
}

.error-msg {
    color: #ef4444; /* Red-500 */
    font-size: 0.75rem; /* Text-xs */
    font-weight: 600;
    margin-top: 0.25rem;
    margin-left: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    animation: slideDownFade 0.3s ease-out;
}

.error-msg svg {
    width: 12px;
    height: 12px;
}

@keyframes errorPulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.28); }
    100% { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1); }
}

@keyframes slideDownFade {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Password strength indicator */
.pw-rules {
    display: grid;
    grid-template-columns: repeat(4, max-content);
    justify-content: center;
    gap: 12px;
    align-items: center;
    justify-items: center;
    padding: 8px 0 2px;
    animation: slideDownFade .25s ease;
}
.pw-rule {
    display: flex;
    max-width: 100%;
    min-width: 0;
    justify-content: center;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
    transition: color .2s ease;
    user-select: none;
    white-space: nowrap;
}

.pw-rule > span:last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pw-rule-icon {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    color: #cbd5e1;
    transition: color .2s ease;
}
.pw-rule-icon .pw-rule-check {
    opacity: 0;
    transition: opacity .2s ease;
}
.pw-rule-pass {
    color: #22c55e;
}
.pw-rule-pass .pw-rule-icon {
    color: #22c55e;
}
.pw-rule-pass .pw-rule-icon .pw-rule-check {
    opacity: 1;
}

/* Login password input: keep placeholder visually centered */
#login-form input[type="password"] {
    line-height: 1.5rem;
}

#login-form input[type="password"]::placeholder {
    line-height: 1.5rem;
}

@media (max-width: 640px) {
    .pw-rules {
        grid-template-columns: repeat(4, max-content);
        justify-content: center;
        gap: 4px;
        justify-items: center;
        padding: 6px 0 2px;
    }
    .pw-rule {
        justify-content: center;
        gap: 3px;
        font-size: 11px;
        letter-spacing: -0.01em;
    }
    .pw-rule-icon {
        width: 13px;
        height: 13px;
    }
}

@media (max-width: 420px) {
    .pw-rules {
        gap: 3px;
    }
    .pw-rule {
        font-size: 10.25px;
        gap: 2px;
    }
    .pw-rule-icon {
        width: 12px;
        height: 12px;
    }
}
