/* Consolidated layout styles — use tokens.css for semantic tokens */
:root {
    --sidebar-width: 260px;
    --header-height: 70px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background: radial-gradient(circle at top right, var(--color-surface), var(--color-bg));
    color: var(--color-text);
    overflow: hidden;
    height: 100vh;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.top-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    border-bottom: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
}

.header-search {
    position: relative;
    width: 400px;
}

.header-search i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-muted);
}

.header-search input {
    width: 100%;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.65rem 1rem 0.65rem 2.8rem;
    color: var(--color-text);
    outline: none;
    transition: var(--transition-normal);
}

.header-search input:focus {
    border-color: var(--color-primary);
    background: var(--color-surface);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.icon-btn {
    position: relative;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--glass-border);
    color: var(--color-text);
    width: 40px;
    height: 40px;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition-normal);
}

.icon-btn .badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--color-primary);
    color: white;
    font-size: 0.6rem;
    font-weight: 800;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3);
}

.icon-btn i {
    font-size: 1.1rem;
    color: var(--color-text-soft);
    opacity: 0.8;
}

.primary-btn {
    background: var(--color-primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-normal);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.primary-btn:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
}

/* View Container */
.view-container {
    flex: 1;
    overflow-y: auto;
    padding: 2.5rem;
}

/* Dashboard Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--color-surface);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 1.5rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: var(--transition-normal);
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--color-primary);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-icon.blue { background: var(--color-primary-light); color: var(--color-primary); }
.stat-icon.green { background: rgba(16, 185, 129, 0.1); color: var(--color-success); }
.stat-icon.orange { background: rgba(245, 158, 11, 0.1); color: var(--color-warning); }
.stat-icon.red { background: rgba(239, 68, 68, 0.1); color: var(--color-danger); }

.stat-info h4 {
    font-size: 0.85rem;
    color: var(--color-muted);
    font-weight: 400;
    margin-bottom: 4px;
}

.stat-info .value {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Charts & Tables */
.dashboard-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

.card {
    background: var(--color-surface);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 1rem;
    font-size: 0.85rem;
    color: var(--color-muted);
    font-weight: 500;
    border-bottom: 1px solid var(--glass-border);
}

td {
    padding: 1rem;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--glass-border);
}

tr:last-child td { border-bottom: none; }

.status-badge {
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-badge.success { background: rgba(16, 185, 129, 0.1); color: var(--color-success); }
.status-badge.warning { background: rgba(245, 158, 11, 0.1); color: var(--color-warning); }
.status-badge.info { background: rgba(99, 102, 241, 0.1); color: var(--color-primary); }

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: var(--transition-normal);
}

.modal {
    background: var(--color-surface);
    width: 90%;
    max-width: 600px;
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal.hidden { display: none; }

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 2rem;
}

.close-modal {
    background: none;
    border: none;
    color: var(--color-muted);
    font-size: 1.25rem;
    cursor: pointer;
}

/* Floating Action Button */
.fab-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 999;
}

.btn-fab {
    width: 60px;
    height: 60px;
    border-radius: 30px;
    background: var(--color-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.5);
    cursor: pointer;
    transition: var(--transition-normal);
    border: none;
}

.btn-fab:hover {
    transform: scale(1.1) rotate(90deg);
    background: var(--primary-light);
}

/* Header User Dropdown */
.header-user-wrap {
    position: relative;
}

.header-user-trigger {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 6px 4px 12px;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.header-user-trigger:hover {
    background: rgba(255, 255, 255, 0.6);
    border-color: var(--color-border);
}

.avatar-wrap {
    position: relative;
    padding: 3px;
    border-radius: 12px;
    background: white;
    border: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.header-user-trigger:hover .avatar-wrap {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-primary-light);
}

.avatar-wrap img {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    object-fit: cover;
}

.header-user-trigger .name {
    font-size: 0.875rem;
    font-weight: 800;
    color: var(--color-text);
    margin-bottom: 2px;
}

.header-user-trigger .text-muted {
    font-size: 0.688rem;
    font-weight: 600;
    color: var(--color-muted);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 240px;
    background: white;
    border-radius: 20px;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-xl);
    padding: 12px;
    display: none;
    z-index: 9999;
    animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--color-muted);
    text-decoration: none;
    font-size: 0.9rem;
    border-radius: 10px;
    transition: var(--transition-normal);
    cursor: pointer;
}

.dropdown-item:hover {
    background: var(--color-bg-soft);
    color: var(--color-primary);
}

.dropdown-item.danger:hover {
    background: rgba(239, 68, 68, 0.05);
    color: var(--color-danger);
}

.dropdown-divider {
    height: 1px;
    background: var(--glass-border);
    margin: 8px 4px;
}

/* Global Search Results */
.global-search-results {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    background: var(--color-surface);
    border-radius: 16px;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-xl);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    padding: 8px;
}

.global-search-results.hidden {
    display: none;
}

.search-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-item:hover {
    background: var(--color-surface-2);
}

.search-item-icon {
    width: 36px;
    height: 36px;
    background: var(--color-surface-2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    font-size: 1rem;
}

.search-item-info {
    flex: 1;
    min-width: 0;
}

.search-item-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-item-subtitle {
    font-size: 0.75rem;
    color: var(--color-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-item-meta {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--color-muted);
    background: var(--color-surface-2);
    padding: 2px 8px;
    border-radius: 6px;
}

.search-no-results {
    padding: 20px;
    text-align: center;
    color: var(--color-muted);
    font-size: 0.875rem;
}

/* ============================================================
   MOBILE / TABLET RESPONSIVE OVERRIDES — Mobil Uyumluluk Planı
   ============================================================ */

/* --- 1.2 Body & app-container scroll davranışı --- */
@media (max-width: 1023px) {
  body { overflow: auto; height: auto; min-height: 100dvh; }
  .app-container { display: block; height: auto; min-height: 100dvh; }
  .main-content { width: 100%; }
  .view-container { padding: 1rem; }
}
@media (max-width: 767px) {
  .view-container { padding: 0.75rem; }
}

/* --- 1.5 Hamburger button --- */
.hamburger-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--color-border);
  width: 40px;
  height: 40px;
  border-radius: 12px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text);
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-right: .75rem;
}
@media (max-width: 1023px) {
  .hamburger-btn { display: inline-flex; }
}

/* --- 1.6 Top header mobile --- */
@media (max-width: 1023px) {
  .top-header {
    padding: 0 1rem;
    gap: .5rem;
    height: 56px;
  }
  .header-search { width: 100%; max-width: 100%; flex: 1; min-width: 0; }
  .header-search input { font-size: 16px; padding: .55rem 1rem .55rem 2.5rem; }
  .header-actions { gap: 8px; }
}
@media (max-width: 600px) {
  .header-search { display: none; }
  .header-actions .icon-btn { width: 36px; height: 36px; }
}
@media (max-width: 1023px) { :root { --header-height: 56px; } }

/* --- 1.8 FAB safe-area --- */
.fab-container {
  bottom: calc(2rem + env(safe-area-inset-bottom));
  right: calc(2rem + env(safe-area-inset-right));
}
@media (max-width: 767px) {
  .fab-container { bottom: calc(1rem + env(safe-area-inset-bottom)); right: 1rem; }
  .btn-fab { width: 52px; height: 52px; font-size: 1.25rem; }
}

/* --- 2.6 Header arama clamp (desktop) --- */
@media (min-width: 1024px) {
  .header-search {
    width: clamp(180px, 28vw, 400px);
    flex: 1 1 auto;
    min-width: 0;
  }
}

/* --- 2.1 Modal mobile bottom-sheet (style.css ikincil .modal tanımı için) --- */
@media (max-width: 767px) {
  .modal-overlay { align-items: flex-end; }
  .modal {
    width: 100%;
    max-width: 100%;
    border-radius: 18px 18px 0 0;
    align-self: flex-end;
  }
  .modal-header, .modal-body { padding: 1rem 1.25rem; }
}

/* --- 2.9 Header user dropdown & lang switcher mobile gizle --- */
@media (max-width: 767px) {
  .header-user-trigger .user-meta,
  .header-user-trigger .user-role,
  .header-user-trigger .user-name-block { display: none; }
  .header-user-trigger { padding: 2px; }
  #finance-banner-root, #auto-redirect-root { display: none; }
}
@media (min-width: 768px) and (max-width: 1023px) {
  #finance-banner-root, #auto-redirect-root { display: none; }
}
