/* =============================================================================
   Krokiew Residence PWA - app.css
   Mobile-first, minimalistyczny styl
   ============================================================================= */

:root {
    --primary: #1e3a5f;
    --primary-dark: #15294a;
    --primary-light: #f0f4fa;
    --accent: #4a90e2;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-500: #64748b;
    --gray-800: #1f2937;
}

html, body { height: 100%; overscroll-behavior: none; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--gray-800);
    background: var(--gray-50);
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
}

/* Bootstrap brand color override */
.btn-primary { --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: var(--primary-dark); --bs-btn-hover-border-color: var(--primary-dark); --bs-btn-active-bg: var(--primary-dark); }
.text-primary { color: var(--primary) !important; }
.bg-primary  { background-color: var(--primary) !important; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* App layout */
#app-main { min-height: calc(100vh - 56px); }

@media (min-width: 768px) {
    #app-content { margin-left: 240px; }
}
@media (max-width: 767px) {
    #app-content { padding-bottom: 80px !important; }
}

/* Sidebar nav */
#side-nav .nav-link, #mobile-nav .nav-link {
    color: var(--gray-800);
    padding: .65rem .85rem;
    border-radius: 8px;
    margin-bottom: 2px;
    display: flex; align-items: center; gap: .65rem;
    font-size: .95rem;
    transition: background-color .12s;
}
#side-nav .nav-link:hover, #mobile-nav .nav-link:hover { background: var(--gray-100); }
#side-nav .nav-link.active, #mobile-nav .nav-link.active {
    background: var(--primary-light); color: var(--primary); font-weight: 600;
}
#side-nav .nav-link i, #mobile-nav .nav-link i { font-size: 1.1rem; width: 22px; }

/* Bottom nav (mobile) */
#bottom-nav-items a {
    flex: 1; padding: .55rem .25rem; text-align: center;
    color: var(--gray-500); text-decoration: none;
    font-size: .7rem; line-height: 1.2;
}
#bottom-nav-items a i { font-size: 1.4rem; display: block; margin-bottom: 2px; }
#bottom-nav-items a.active { color: var(--primary); }

/* Avatar */
.avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--accent); color: white;
    font-weight: 600; font-size: .85rem;
    overflow: hidden; flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 96px; height: 96px; font-size: 2rem; }
.avatar-sm { width: 28px; height: 28px; font-size: .7rem; }

/* Cards */
.card { border: 1px solid var(--gray-200); border-radius: 10px; }
.card-header { background: white; border-bottom: 1px solid var(--gray-200); font-weight: 600; }

/* Forms */
.form-control:focus, .form-select:focus {
    border-color: var(--primary); box-shadow: 0 0 0 3px rgba(30,58,95,.15);
}
.form-label { font-weight: 500; font-size: .9rem; margin-bottom: .25rem; }

/* Page header */
.page-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem;
    gap: .5rem; flex-wrap: wrap;
}
.page-header h1 { font-size: 1.4rem; margin: 0; color: var(--primary); font-weight: 600; }

/* Table */
.table { background: white; }
.table thead th { background: var(--gray-50); font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; color: var(--gray-500); border-bottom: 2px solid var(--gray-200); }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: var(--primary-light) !important; }

/* Badges */
.badge { font-weight: 500; padding: .35em .6em; }
.badge-active   { background: #d1fae5; color: #065f46; }
.badge-inactive { background: #fee2e2; color: #991b1b; }

/* Empty state */
.empty-state {
    text-align: center; padding: 3rem 1rem; color: var(--gray-500);
}
.empty-state .bi { font-size: 3rem; opacity: .3; display: block; margin-bottom: .5rem; }

/* Floating Action Button */
.fab {
    position: fixed; bottom: 80px; right: 16px;
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--primary); color: white; border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,.2);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem; z-index: 1015;
}
.fab:hover { background: var(--primary-dark); }
@media (min-width: 768px) {
    .fab { bottom: 24px; right: 24px; }
}

/* Login screen */
.login-screen {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, #2c5282 100%);
    padding: 1rem;
}
.login-card {
    background: white; border-radius: 12px; padding: 2rem 1.5rem;
    width: 100%; max-width: 400px; box-shadow: 0 10px 30px rgba(0,0,0,.15);
}
.login-card h1 { font-size: 1.5rem; color: var(--primary); margin-bottom: 1.5rem; text-align: center; font-weight: 600; }
.login-card .logo { text-align: center; margin-bottom: 1rem; }
.login-card .logo i { font-size: 3rem; color: var(--primary); }

/* Skeleton loader */
.skeleton { background: linear-gradient(90deg, var(--gray-100) 0%, var(--gray-200) 50%, var(--gray-100) 100%);
    background-size: 200% 100%; animation: skel 1.4s infinite; border-radius: 4px; }
@keyframes skel { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Pagination */
.pagination { gap: .25rem; }
.page-link { color: var(--primary); border-color: var(--gray-200); }
.page-item.active .page-link { background-color: var(--primary); border-color: var(--primary); }

/* Permissions matrix */
.perm-group { background: var(--gray-50); padding: .5rem .75rem; font-weight: 600; font-size: .85rem; color: var(--gray-500); text-transform: uppercase; }
.perm-row { padding: .5rem .75rem; border-top: 1px solid var(--gray-200); display: flex; justify-content: space-between; align-items: center; }

/* Audit log entry */
.audit-entry { padding: .75rem; border-bottom: 1px solid var(--gray-200); }
.audit-entry:hover { background: var(--gray-50); }
.audit-action { font-weight: 600; font-size: .9rem; color: var(--primary); }
.audit-meta { font-size: .8rem; color: var(--gray-500); }

/* Utility */
.cursor-pointer { cursor: pointer; }
.text-truncate-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Dark mode (auto) */
@media (prefers-color-scheme: dark) {
    /* Zachowane na później - na razie tylko light */
}

/* Safe areas (iOS notch) */
.safe-top    { padding-top:    env(safe-area-inset-top); }
.safe-bottom { padding-bottom: env(safe-area-inset-bottom); }

/* === Cash module - mobile cards === */
.cash-list-mobile { display: flex; flex-direction: column; gap: .5rem; }
.cash-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: .5rem;
    padding: .6rem .75rem;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
    transition: background-color .15s;
}
.cash-card.cash-row-editable { cursor: pointer; }
.cash-card.cash-row-editable:active { background: #f3f4f6; }
.cash-card-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: .5rem; margin-bottom: .35rem;
}
.cash-card-date { display: flex; align-items: center; gap: .35rem; font-size: .9rem; }
.cash-card-date i { font-size: 1.1rem; }
.cash-card-amount { font-size: 1.05rem; white-space: nowrap; }
.cash-card-meta { display: flex; flex-wrap: wrap; gap: .25rem; margin-bottom: .25rem; }
.cash-card-body { line-height: 1.35; }
.cash-card-body > div + div { margin-top: .15rem; }
.cash-card-foot { margin-top: .35rem; padding-top: .35rem; border-top: 1px dashed #e5e7eb; }

@media (max-width: 575.98px) {
    .page-header h1 { font-size: 1.25rem; }
    #cash-safes-tabs .safe-tab { font-size: .85rem; padding: .35rem .55rem; }
    #cash-summary { font-size: .85rem; gap: .75rem !important; }
    .cash-card { padding: .55rem .65rem; border-radius: .4rem; }
    .cash-card-amount { font-size: 1rem; }
}
/* === Słowniki - kafelki === */
.dict-tile { transition: transform .12s, box-shadow .12s; }
.dict-tile:hover { transform: translateY(-2px); box-shadow: 0 .35rem .9rem rgba(0,0,0,.08); }
.dict-tile-icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    background: #eff6ff;
    color: #2563eb;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem; flex-shrink: 0;
}