@font-face {
    font-family: itim;
    src: url(/assets/font/Itim-Regular.ttf);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: itim, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html {
    font-size: clamp(14px, 2.5vw, 16px);
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    line-height: 1.6;
    background: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
    min-height: 100vh;
}

.hidden {
    display: none !important;
    opacity: 0 !important;
}

/* CSS Variables */
:root {
    --spacing-unit: clamp(0.75rem, 2vw, 1rem);
    --sidebar-width: clamp(12rem, 20vw, 16rem);
    --focus-ring-color: rgba(59, 130, 246, 0.5);
    --border-radius: 0.5rem;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.2);
    --transition: all 0.2s ease;
}

/* Theme Definitions */
body[data-theme="light"] {
    --bg-color: #f3f4f6;
    --text-color: #1f2937;
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --sidebar-bg: #2563eb;
    --sidebar-header-bg: linear-gradient(180deg, #1e40af, #2563eb);
    --active-bg: #1e40af;
    --active-text: #ffffff;
    --card-bg: #ffffff;
    --border-color: #e5e7eb;
    --hover-bg: #f1f5f9;
}

body[data-theme="dark"] {
    --bg-color: #1f2937;
    --text-color: #d1d5db;
    --primary-color: #60a5fa;
    --secondary-color: #2563eb;
    --sidebar-bg: #1e40af;
    --sidebar-header-bg: linear-gradient(180deg, #1e3a8a, #1e40af);
    --active-bg: #2563eb;
    --active-text: #ffffff;
    --card-bg: #374151;
    --border-color: #4b5563;
    --hover-bg: #4b5563;
}

body[data-theme="solarized"] {
    --bg-color: #fdf6e3;
    --text-color: #657b83;
    --primary-color: #268bd2;
    --secondary-color: #073642;
    --sidebar-bg: #268bd2;
    --sidebar-header-bg: linear-gradient(180deg, #073642, #268bd2);
    --active-bg: #073642;
    --active-text: #fdf6e3;
    --card-bg: #eee8d5;
    --border-color: #93a1a1;
    --hover-bg: #f5e8c7;
}

body[data-theme="midnight"] {
    --bg-color: #0d1117;
    --text-color: #c9d1d9;
    --primary-color: #238636;
    --secondary-color: #2ea043;
    --sidebar-bg: #161b22;
    --sidebar-header-bg: linear-gradient(180deg, #0d1117, #161b22);
    --active-bg: #2ea043;
    --active-text: #ffffff;
    --card-bg: #161b22;
    --border-color: #30363d;
    --hover-bg: #21262d;
}

body[data-theme="cartoon"] {
    --bg-color: #ffd700;
    --text-color: #333333;
    --primary-color: #ff4500;
    --secondary-color: #ff8c00;
    --sidebar-bg: #ff4500;
    --sidebar-header-bg: linear-gradient(180deg, #ff8c00, #ff4500);
    --active-bg: #ff8c00;
    --active-text: #ffffff;
    --card-bg: #fffacd;
    --border-color: #ffd700;
    --hover-bg: #fff5b3;
}

body[data-theme="baby-blue"] {
    --bg-color: #e6f3ff;
    --text-color: #333333;
    --primary-color: #4a90e2;
    --secondary-color: #357abd;
    --sidebar-bg: #4a90e2;
    --sidebar-header-bg: linear-gradient(180deg, #357abd, #4a90e2);
    --active-bg: #357abd;
    --active-text: #ffffff;
    --card-bg: #f0f8ff;
    --border-color: #b3d4fc;
    --hover-bg: #d1e6ff;
}

body[data-theme="baby-pink"] {
    --bg-color: #ffe4e6;
    --text-color: #333333;
    --primary-color: #ff6b81;
    --secondary-color: #d81b60;
    --sidebar-bg: #ff6b81;
    --sidebar-header-bg: linear-gradient(180deg, #d81b60, #ff6b81);
    --active-bg: #d81b60;
    --active-text: #ffffff;
    --card-bg: #fff0f5;
    --border-color: #ffc1cc;
    --hover-bg: #ffd1d6;
}

body[data-theme="candy"] {
    --bg-color: #f0c4d5;
    --text-color: #18001b;
    --primary-color: #f8469f;
    --secondary-color: #c9096f;
    --sidebar-bg: #1f49a3;
    --sidebar-header-bg: linear-gradient(180deg, #ff1493, #ff69b4);
    --active-bg: #bd0f6b;
    --active-text: #ffffff;
    --card-bg: #ffddf1;
    --border-color: #ffb6c1;
    --hover-bg: #ffd9e6;
}

.gradient-asli-text {
    background: linear-gradient(180deg, #ff1493, #ff69b4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-fill-color: transparent;
}

body[data-theme="corporate"] {
    --bg-color: #f5f6f5;
    --text-color: #333333;
    --primary-color: #004085;
    --secondary-color: #005cbf;
    --sidebar-bg: #004085;
    --sidebar-header-bg: linear-gradient(180deg, #003087, #004085);
    --active-bg: #005cbf;
    --active-text: #ffffff;
    --card-bg: #ffffff;
    --border-color: #ced4da;
    --hover-bg: #e9ecef;
}

body[data-theme="elegant"] {
    --bg-color: #2c2c2c;
    --text-color: #e0e0e0;
    --primary-color: #b8860b;
    --secondary-color: #daa520;
    --sidebar-bg: #b8860b;
    --sidebar-header-bg: linear-gradient(180deg, #daa520, #b8860b);
    --active-bg: #daa520;
    --active-text: #ffffff;
    --card-bg: #3c3c3c;
    --border-color: #696969;
    --hover-bg: #4a4a4a;
}

body[data-theme="fairytale"] {
    --bg-color: #f0e4d7;
    --text-color: #333333;
    --primary-color: #ff9a8b;
    --secondary-color: #ff6f61;
    --sidebar-bg: #ff9a8b;
    --sidebar-header-bg: linear-gradient(180deg, #ff6f61, #ff9a8b);
    --active-bg: #ff6f61;
    --active-text: #ffffff;
    --card-bg: #fff5e6;
    --border-color: #ffccbc;
    --hover-bg: #ffe6d9;
}

body[data-theme="jungle"] {
    --bg-color: #1a3c34;
    --text-color: #e6f0ea;
    --primary-color: #228b22;
    --secondary-color: #2e8b57;
    --sidebar-bg: #228b22;
    --sidebar-header-bg: linear-gradient(180deg, #2e8b57, #228b22);
    --active-bg: #2e8b57;
    --active-text: #ffffff;
    --card-bg: #2f4f4f;
    --border-color: #3cb371;
    --hover-bg: #3a5f5f;
}

body[data-theme="nature"] {
    --bg-color: #e8f5e9;
    --text-color: #333333;
    --primary-color: #4caf50;
    --secondary-color: #388e3c;
    --sidebar-bg: #4caf50;
    --sidebar-header-bg: linear-gradient(180deg, #388e3c, #4caf50);
    --active-bg: #388e3c;
    --active-text: #ffffff;
    --card-bg: #f1f8e9;
    --border-color: #c8e6c9;
    --hover-bg: #dcedc8;
}

body[data-theme="ocean"] {
    --bg-color: #e0f7fa;
    --text-color: #333333;
    --primary-color: #0288d1;
    --secondary-color: #0277bd;
    --sidebar-bg: #0288d1;
    --sidebar-header-bg: linear-gradient(180deg, #0277bd, #0288d1);
    --active-bg: #0277bd;
    --active-text: #ffffff;
    --card-bg: #e1f5fe;
    --border-color: #b3e5fc;
    --hover-bg: #b3e5fc;
}

body[data-theme="playful"] {
    --bg-color: #fff3e0;
    --text-color: #333333;
    --primary-color: #ff5722;
    --secondary-color: #ef6c00;
    --sidebar-bg: #ff5722;
    --sidebar-header-bg: linear-gradient(180deg, #ef6c00, #ff5722);
    --active-bg: #ef6c00;
    --active-text: #ffffff;
    --card-bg: #fff8e1;
    --border-color: #ffccbc;
    --hover-bg: #ffedd5;
}

body[data-theme="rainbow"] {
    --bg-color: #ffffff;
    --text-color: #333333;
    --primary-color: #ff0000;
    --secondary-color: #ff00ff;
    --sidebar-bg: linear-gradient(45deg, #ff0000, #ff00ff);
    --sidebar-header-bg: linear-gradient(180deg, #ff00ff, #ff0000);
    --active-bg: #ff00ff;
    --active-text: #ffffff;
    --card-bg: #f0f0f0;
    --border-color: #cccccc;
    --hover-bg: #f9f9f9;
}

body[data-theme="retro"] {
    --bg-color: #f5f5f5;
    --text-color: #333333;
    --primary-color: #c71585;
    --secondary-color: #9400d3;
    --sidebar-bg: #c71585;
    --sidebar-header-bg: linear-gradient(180deg, #9400d3, #c71585);
    --active-bg: #9400d3;
    --active-text: #ffffff;
    --card-bg: #e0e0e0;
    --border-color: #bdbdbd;
    --hover-bg: #d3d3d3;
}

body[data-theme="toy-box"] {
    --bg-color: #ffeb3b;
    --text-color: #333333;
    --primary-color: #2196f3;
    --secondary-color: #1976d2;
    --sidebar-bg: #2196f3;
    --sidebar-header-bg: linear-gradient(180deg, #1976d2, #2196f3);
    --active-bg: #1976d2;
    --active-text: #ffffff;
    --card-bg: #fff9c4;
    --border-color: #ffca28;
    --hover-bg: #fff59d;
}

body[data-theme="vibrant"] {
    --bg-color: #212121;
    --text-color: #ffffff;
    --primary-color: #ffeb3b;
    --secondary-color: #fbc02d;
    --sidebar-bg: #ffeb3b;
    --sidebar-header-bg: linear-gradient(180deg, #fbc02d, #ffeb3b);
    --active-bg: #fbc02d;
    --active-text: #333333;
    --card-bg: #424242;
    --border-color: #757575;
    --hover-bg: #616161;
}

body[data-theme="minimalist"] {
    --bg-color: #ffffff;
    --text-color: #333333;
    --primary-color: #000000;
    --secondary-color: #333333;
    --sidebar-bg: #000000;
    --sidebar-header-bg: #333333;
    --active-bg: #333333;
    --active-text: #ffffff;
    --card-bg: #f5f5f5;
    --border-color: #dddddd;
    --hover-bg: #e0e0e0;
}

/* Typography */
h1 {
    font-size: clamp(1.8rem, 4.5vw, 2.5rem);
    font-weight: 700;
    margin-bottom: clamp(0.75rem, 2vw, 1rem);
}

h2 {
    font-size: clamp(1.4rem, 3.5vw, 2rem);
    font-weight: 600;
    margin-bottom: clamp(0.5rem, 1.5vw, 0.75rem);
}

h3,
h4,
label {
    font-weight: 500;
    margin-bottom: clamp(0.25rem, 1vw, 0.5rem);
}

h3 {
    font-size: clamp(1.2rem, 3vw, 1.75rem);
}

h4,
label {
    font-size: clamp(1rem, 2.5vw, 1.5rem);
}

h5,
h7 {
    font-weight: 400;
}

h5 {
    font-size: clamp(0.875rem, 2vw, 1.25rem);
}

div,
h6,
p,
span {
    font-size: clamp(0.85rem, 2vw, 1rem);
}

h7 {
    font-size: clamp(0.75rem, 1.8vw, 0.875rem);
}

legend {
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    font-weight: 600;
}

/* Form Elements */
button,
input,
select,
textarea {
    font-family: itim;
    font-size: clamp(0.85rem, 2vw, 1rem);
    transition: var(--transition);
    border-radius: var(--border-radius);
}

button {
    cursor: pointer;
    border: none;
    padding: clamp(0.4rem, 1.5vw, 0.5rem) clamp(0.8rem, 2vw, 1rem);
    background: var(--primary-color);
    color: var(--active-text);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--focus-ring-color);
}

input,
select,
textarea {
    border: 1px solid var(--border-color);
    padding: clamp(0.4rem, 1.5vw, 0.5rem);
    background: var(--card-bg);
    color: var(--text-color);
    width: 100%;
}

input::placeholder,
textarea::placeholder {
    color: color-mix(in srgb, var(--text-color) 50%, transparent);
}

/* Layout */
.container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: var(--spacing-unit);
}

@media (min-width: 1024px) {
    .container {
        max-width: 1200px;
    }
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--active-text);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-md);
    z-index: 50;
    overscroll-behavior: contain;
    overflow-x: hidden;
    overflow-y: auto;
    will-change: transform;
    -webkit-overflow-scrolling: touch;
}

.sidebar[data-state=closed] .menu-item[data-tooltip]:hover:after {
    content: attr(data-tooltip);
    position: absolute;
    left: 5rem;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(17, 24, 39, 0.95);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    white-space: nowrap;
    z-index: 60;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 1;
    transition: opacity 0.2s ease;
}

.sidebar[data-state=open] .menu-item[data-tooltip]:hover:after {
    display: none;
}

.sidebar[data-state=closed] {
    width: clamp(3.5rem, 10vw, 4rem);
    transform: translateX(0);
    box-shadow: none;
}

@media (max-width: 767px) {
    .sidebar {
        max-width: 100%; /* Mobil için tam genişlik */
    }
    .sidebar[data-state="closed"] {
        width: 0;
        transform: translateX(-100%);
        visibility: hidden;
    }
}

.sidebar-header {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--sidebar-header-bg);
    border-bottom: 1px solid var(--border-color);
    padding: var(--spacing-unit);
}

.sidebar-header picture img {
    max-width: 100%;
    height: auto;
}

.menu {
    padding: var(--spacing-unit);
}

.menu-item {
    position: relative;
    margin-bottom: 0.75rem; /* Öğeler arası boşluk artırıldı */
    min-height: 64px; /* Daha büyük dokunma alanı */
}

.menu-item button {
    display: flex;
    align-items: center;
    width: 100%;
    padding: clamp(1.25rem, 3vw, 1.5rem); /* Daha geniş hit alanı */
    background: transparent;
    text-align: left;
    font-size: clamp(1rem, 2.2vw, 1.15rem);
    color: var(--active-text);
    border-radius: var(--border-radius);
    transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
    border: 1px solid transparent;
}

.menu-item button:hover {
    background: var(--hover-bg);
    transform: translateX(3px);
}

.menu-item button:active {
    transform: scale(0.98);
    /* Tıklama geri bildirimi */
}

.menu-item.active button {
    background: var(--active-bg);
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.15);
    color: var(--active-text);
}

.has-submenu button[aria-expanded="true"] {
    background: color-mix(in srgb, var(--active-bg) 10%, transparent);
}

.submenu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px; /* Daha büyük tıklama alanı */
    height: 32px;
    transition: transform 0.2s ease;
}

.has-submenu button[aria-expanded="true"] .submenu-toggle {
    transform: rotate(90deg);
}

.sub-menu,
.sub-sub-menu {
    max-height: none !important;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    padding-left: clamp(1rem, 2.5vw, 1.5rem);
    background: color-mix(in srgb, var(--sidebar-bg) 90%, #000);
    border-radius: var(--border-radius);
}

.sub-menu:not(.hidden),
.sub-sub-menu:not(.hidden) {
    max-height: 600px; /* Daha uzun şehir listeleri için */
}


.sub-item,
.sub-sub-item {
    padding: clamp(1rem, 2.5vw, 1.25rem);
    font-size: clamp(0.95rem, 2vw, 1.05rem);
    cursor: pointer;
    border-radius: var(--border-radius);
    min-height: 64px; /* Daha büyük dokunma alanı */
    transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    border: 1px solid transparent;
    user-select: none;
}

.sub-item:hover,
.sub-sub-item:hover {
    background: var(--hover-bg);
}

.sub-item:active,
.sub-sub-item:active {
    transform: scale(0.98);
}

.sub-menu.hidden,
.sub-sub-menu.hidden {
    display: none;
}

/* Sidebar Overlay */
#sidebarOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 40;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#sidebarOverlay[data-state=visible] {
    opacity: 1;
    pointer-events: auto;
}

#sidebarOverlay[data-state=hidden] {
    opacity: 0;
    pointer-events: none;
}

#content {
    margin-left: 0;
    min-height: 100vh;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: var(--spacing-unit);
}

.user-profile {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    margin: clamp(0.4rem, 1.5vw, 0.5rem);
    border-radius: 0.5rem;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
}

@media print {

    .sidebar,
    #sidebarOverlay {
        display: none !important;
    }

    #content {
        margin-left: 0 !important;
    }
}

@media (min-width: 768px) {
    #content {
        margin-left: var(--sidebar-width);
    }

    .sidebar[data-state=closed]+#content {
        margin-left: clamp(3.5rem, 10vw, 4rem);
    }

    .sidebar[data-state=closed] .menu-text,
    .sidebar[data-state=closed] .submenu-toggle,
    .sidebar[data-state=closed] .user-profile {
        display: none;
    }

    .sidebar[data-state=closed] .icon {
        margin-right: 0;
        margin-left: 0.5rem;
    }
}

@media (max-width: 767px) {
    .sidebar[data-state=open]+#content {
        filter: blur(3px);
        pointer-events: none;
    }

    .sidebar[data-state=closed] .menu-text,
    .sidebar[data-state=closed] .user-profile,
    .sidebar[data-state=closed] .sidebar-header {
        display: none;
    }
}

/* Enhanced Top Header */
.top-header {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
    padding: clamp(0.75rem, 2.5vw, 1.25rem) var(--spacing-unit);
    border-bottom: 1px solid var(--border-color);
    transition: box-shadow 0.3s ease, background 0.3s ease;
    gap: clamp(0.5rem, 2vw, 1rem);
    background-image:
        linear-gradient(45deg, fuchsia 0.5px, transparent 0.5px),
        linear-gradient(-45deg, fuchsia 0.5px, transparent 0.5px);
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: center;
}

.top-header.scrolled {
    box-shadow: var(--shadow-md);
    background: color-mix(in srgb, var(--card-bg) 95%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.header-logo {
    display: flex;
    align-items: center;
    gap: clamp(0.5rem, 1.5vw, 0.75rem);
}

.header-logo img {
    height: clamp(1.8rem, 5vw, 2.5rem);
    width: auto;
    transition: transform 0.2s ease;
}

.header-logo img:hover {
    transform: scale(1.05);
}

.header-logo span {
    font-size: clamp(1rem, 2.5vw, 1.3rem);
    font-weight: 700;
    color: var(--text-color);
    white-space: nowrap;
}

#menuToggle {
    background: transparent;
    color: var(--text-color);
    font-size: clamp(1.5rem, 4vw, 1.75rem);
    padding: clamp(0.4rem, 1.5vw, 0.5rem);
    border-radius: var(--border-radius);
    transition: var(--transition), transform 0.2s ease;
}

#menuToggle:hover {
    background: var(--hover-bg);
    color: var(--primary-color);
    transform: rotate(90deg);
}

#menuToggle:focus {
    box-shadow: 0 0 0 3px var(--focus-ring-color);
}

.header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: clamp(0.5rem, 1.5vw, 1rem);
    flex: 1;
}

.language-switcher {
    display: flex;
    align-items: center;
    gap: clamp(0.4rem, 1vw, 0.5rem);
    padding: clamp(0.4rem, 1.5vw, 0.5rem);
    border-radius: var(--border-radius);
    background: color-mix(in srgb, var(--card-bg) 90%, #000);
    border: 1px solid var(--border-color);
}

.language-switcher a {
    text-decoration: none;
    color: var(--text-color);
    padding: clamp(0.2rem, 1vw, 0.25rem) clamp(0.5rem, 1.5vw, 0.75rem);
    border-radius: 0.25rem;
    font-size: clamp(0.8rem, 1.8vw, 0.875rem);
    transition: var(--transition);
}

.language-switcher a:hover,
.language-switcher a.font-bold {
    background: var(--primary-color);
    color: var(--active-text);
}

#themeSelector {
    width: 100%;
    max-width: clamp(100px, 25vw, 120px);
    padding: clamp(0.4rem, 1.5vw, 0.5rem);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--card-bg);
    color: var(--text-color);
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>');
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px;
    transition: var(--transition);
}

#themeSelector:hover {
    border-color: var(--primary-color);
    background: var(--hover-bg);
}

#themeSelector:focus {
    box-shadow: 0 0 0 3px var(--focus-ring-color);
    border-color: var(--primary-color);
}

.header-search {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    max-width: clamp(150px, 40vw, 180px);
}

.header-search input {
    width: 100%;
    padding: clamp(0.4rem, 1.5vw, 0.5rem) clamp(2rem, 5vw, 2.5rem) clamp(0.4rem, 1.5vw, 0.5rem) clamp(0.8rem, 2vw, 1rem);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--card-bg);
    color: var(--text-color);
    font-size: clamp(0.8rem, 1.8vw, 0.875rem);
    transition: var(--transition);
}

.header-search input::placeholder {
    color: color-mix(in srgb, var(--text-color) 50%, transparent);
}

.header-search input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--focus-ring-color);
}

.header-search button {
    position: absolute;
    right: clamp(0.5rem, 1.5vw, 0.75rem);
    background: transparent;
    color: var(--text-color);
    padding: clamp(0.2rem, 1vw, 0.25rem);
    font-size: clamp(1rem, 3vw, 1.25rem);
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.header-search button:hover {
    color: var(--primary-color);
    transform: scale(1.1);
}

@media (max-width: 767px) {
    .top-header {
        flex-direction: column;
        align-items: stretch;
        padding: var(--spacing-unit);
    }

    .header-logo {
        justify-content: flex-start;
        margin-bottom: clamp(0.5rem, 2vw, 0.75rem);
    }

    .header-actions {
        flex-direction: column;
        align-items: stretch;
        gap: clamp(0.5rem, 2vw, 0.75rem);
    }

    .header-search,
    #themeSelector {
        max-width: 100%;
    }

    #menuToggle {
        position: absolute;
        top: var(--spacing-unit);
        left: var(--spacing-unit);
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .header-search {
        max-width: clamp(100px, 30vw, 120px);
    }

    .header-logo span {
        font-size: clamp(1rem, 2.5vw, 1.1rem);
    }
}

/* Toast Notifications */
#toastContainer {
    position: fixed;
    top: clamp(0.75rem, 2vw, 1rem);
    right: clamp(0.75rem, 2vw, 1rem);
    display: flex;
    flex-direction: column;
    gap: clamp(0.4rem, 1.5vw, 0.5rem);
    z-index: 100;
}

#toastContainer div {
    padding: clamp(0.6rem, 2vw, 0.75rem) clamp(0.8rem, 2.5vw, 1rem);
    box-shadow: var(--shadow-md);
    font-size: clamp(0.8rem, 1.8vw, 0.875rem);
    max-width: clamp(250px, 80vw, 300px);
    border-radius: var(--border-radius);
}

#toastContainer div.bg-green-500 {
    background: #10b981;
}

#toastContainer div.bg-red-500 {
    background: #ef4444;
}

/* Tab Content */
.tab-content {
    padding-top: clamp(0.75rem, 2vw, 1rem);
}

.tab-content:not(.hidden) {
    animation: fadeIn 0.3s ease-out;
}

/* Home Tab */
#homeTab .notifications,
#homeTab .needs-section,
#homeTab .advertisement-section,
#homeTab .stats-section,
#homeTab .announcement-section {
    background: var(--card-bg);
    padding: var(--spacing-unit);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

#notificationList p {
    padding: clamp(0.4rem, 1.5vw, 0.5rem) 0;
}

#notificationList p.font-semibold {
    color: var(--primary-color);
}

.needs-section .filters {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(0.4rem, 1.5vw, 0.5rem);
    border: 1px solid var(--border-color);
    padding: var(--spacing-unit);
    background: var(--card-bg);
    border-radius: var(--border-radius);
}

.needs-table {
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    overflow-x: auto;
    background: var(--card-bg);
}

#needsTable {
    width: 100%;
    min-width: 300px;
    border-collapse: collapse;
}

#needsTable th,
#needsTable td {
    padding: clamp(0.6rem, 2vw, 0.75rem);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

#needsTable th {
    position: sticky;
    top: 0;
    z-index: 1;
    cursor: pointer;
    background: var(--sidebar-header-bg);
    color: var(--active-text);
}

#needsTable th.sorted-asc::after,
#needsTable th.sorted-desc::after {
    content: '';
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    margin-left: 0.25rem;
    border: 0.25rem solid transparent;
}

#needsTable th.sorted-asc::after {
    border-bottom-color: var(--active-text);
}

#needsTable th.sorted-desc::after {
    border-top-color: var(--active-text);
}

#needsTable tr:hover {
    background: var(--hover-bg);
}

#needsTable button {
    padding: clamp(0.2rem, 1vw, 0.25rem) clamp(0.4rem, 1.5vw, 0.5rem);
    font-size: clamp(0.8rem, 1.8vw, 0.875rem);
    border-radius: var(--border-radius);
}

.edit-need {
    background: var(--primary-color);
}

.delete-need {
    background: #dc2626;
}

.delete-need:hover {
    background: #b91c1c;
}

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-unit);
    flex-wrap: wrap;
    gap: clamp(0.5rem, 2vw, 0.75rem);
}

/* Touch-Friendly Styles */
.touch-friendly {
    min-width: 48px;
    min-height: 48px;
    padding: 12px;
    font-size: 16px;
    touch-action: manipulation;
    /* Prevent double-tap zoom */
}

.pagination-btn {
    background: var(--primary-color);
    color: var(--active-text);
    border-radius: 8px;
    transition: transform 0.1s ease, opacity 0.2s ease, background 0.2s ease;
    min-width: 64px;
    text-align: center;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--secondary-color);
}

.pagination-btn:active:not(:disabled) {
    transform: scale(0.95);
    /* Visual feedback for tap */
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Pagination */
.pagination-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 16px;
    touch-action: pan-y;
    /* Allow vertical scrolling */
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
}

.page-input {
    width: 80px;
    height: 48px;
    font-size: 16px;
    text-align: center;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-color);
    touch-action: manipulation;
}

.page-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--focus-ring-color);
}

.page-input:disabled {
    opacity: 0.5;
}

/* Mobile Optimization */
@media (max-width: 767px) {
    .pagination-container {
        gap: 12px;
        padding: 12px;
    }

    .page-input {
        width: 70px;
    }

    .pagination-btn {
        min-width: 56px;
        padding: 10px;
    }
}

.advertisement-section {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(0.75rem, 2.5vw, 1rem);
}

.ad-bar {
    flex: 1;
    min-width: clamp(200px, 45vw, 300px);
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
    border-radius: var(--border-radius);
    padding: var(--spacing-unit);
}

.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(clamp(180px, 30vw, 200px), 1fr));
    gap: clamp(0.75rem, 2.5vw, 1rem);
}

.stat-item {
    padding: var(--spacing-unit);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    background: var(--sidebar-header-bg);
    transition: transform 0.3s;
}

.stat-item:hover {
    transform: scale(1.05);
}

.stat-value {
    font-size: clamp(1.4rem, 3.5vw, 2rem);
}

.stat-label {
    font-size: clamp(0.8rem, 1.8vw, 0.875rem);
}

.announcement-section {
    background: color-mix(in srgb, var(--primary-color) 10%, var(--card-bg));
}

/* Schools Tab */
#schoolsTab .filters {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(0.4rem, 1.5vw, 0.5rem);
    margin-bottom: clamp(0.75rem, 2.5vw, 1rem);
}

#schoolsTab .schools-list {
    background: var(--card-bg);
    padding: var(--spacing-unit);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

#schoolsList li {
    padding: clamp(0.6rem, 2vw, 0.75rem);
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
    border-radius: var(--border-radius);
    transition: background 0.2s;
}

#schoolsList li:hover {
    background: var(--hover-bg);
}

#schoolsError {
    color: #ef4444;
}

/* Donors Tab */
#donorsTab .donors-list,
#donorsTab .donation-form {
    background: var(--card-bg);
    padding: var(--spacing-unit);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

#donorsTab table {
    width: 100%;
    min-width: 300px;
    border-collapse: collapse;
}

#donorsTab table th,
#donorsTab table td {
    padding: clamp(0.6rem, 2vw, 0.75rem);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

#donationForm .step:not([hidden]) {
    display: flex;
    flex-direction: column;
    gap: clamp(0.75rem, 2.5vw, 1rem);
}

.step.hidden {
    display: none !important;
}

#schoolDonationItems,
#studentDonationItems,
#schoolNeeds {
    padding: clamp(0.4rem, 1.5vw, 0.5rem);
    border-radius: var(--border-radius);
    background: color-mix(in srgb, var(--card-bg) 95%, #000);
}

/* Cities Tab */
#citiesTab .cities-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-unit);
}

@media (min-width: 1024px) {
    #citiesTab .cities-container {
        grid-template-columns: 2fr 1fr;
    }
}

#citiesTab .filters {
    background: var(--card-bg);
    padding: var(--spacing-unit);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

#citiesList li {
    padding: clamp(0.6rem, 2vw, 0.75rem);
    border-radius: var(--border-radius);
    transition: background 0.2s;
    cursor: pointer;
}

#citiesList li:hover,
#citiesList li.active {
    background: var(--hover-bg);
}

.city-details {
    background: var(--card-bg);
    padding: var(--spacing-unit);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.city-details .stat-item {
    background: color-mix(in srgb, var(--card-bg) 95%, #000);
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    max-width: clamp(300px, 90vw, 600px);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    color: var(--text-color);
    padding: var(--spacing-unit);
    animation: slideIn 0.3s ease-out;
}

.modal-close {
    background: transparent;
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    color: var(--text-color);
}

.modal-close:hover {
    color: var(--primary-color);
}

/* Footer */
.footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: var(--spacing-unit);
    text-align: center;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Responsive Adjustments */
@media (max-width: 767px) {
    html {
        font-size: clamp(12px, 2.5vw, 14px);
    }

    .container {
        padding: clamp(0.4rem, 1.5vw, 0.5rem);
    }

    .sidebar {
        max-width: 100%;
    }

    .ad-bar {
        min-width: 100%;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .sidebar {
        max-width: clamp(10rem, 20vw, 12rem);
    }

    #content {
        margin-left: clamp(10rem, 20vw, 12rem);
    }

    .sidebar[data-state=closed]+#content {
        margin-left: clamp(3.5rem, 10vw, 4rem);
    }
}

/* Additional Styles */
.loading-skeleton {
    background: var(--card-bg);
    opacity: 0.7;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    inset: 0;
}

.lazy-load {
    opacity: 0;
    transition: opacity 0.3s;
}

.lazy-load[src] {
    opacity: 1;
}

.status-active {
    color: #10b981;
    font-weight: 500;
}

.donate-btn {
    background: var(--primary-color);
    color: var(--active-text);
    padding: clamp(0.4rem, 1.5vw, 0.5rem) clamp(0.8rem, 2vw, 1rem);
    border-radius: var(--border-radius);
}

.donate-btn:hover {
    background: var(--secondary-color);
}

.need-item {
    cursor: pointer;
    transition: box-shadow 0.2s ease;
}

.need-item:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.need-item[aria-expanded="true"] .expand-need svg {
    transform: rotate(180deg);
}

.need-details {
    transition: opacity 0.2s ease;
}

.need-details.hidden {
    opacity: 0;
    height: 0;
    overflow: hidden;
}

.contribute-btn {
    transition: background-color 0.2s ease;
}

.contribute-btn:hover {
    background-color: #059669;
}

svg {
    transition: transform 0.2s ease;
}

#about_content {
    font-weight: bold;
}