/* 
   Puantor Personnel PWA Stylesheet
   Version: 1.2
   Design System: Glassmorphic Modern App Shell (Adapted from Mobile Design)
*/

:root {
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --safe-area-top: env(safe-area-inset-top, 0px);
  --app-header-height: calc(56px + var(--safe-area-top));
  --app-nav-height: calc(64px + var(--safe-area-bottom));
  
  /* Color Tokens */
  --mobile-primary: #206bc4; /* Tabler Blue */
  --mobile-bg-light: #f6f8fb;
  --mobile-bg-dark: #1a2234;
  --mobile-card-border-light: rgba(0, 0, 0, 0.12);
  --mobile-card-border-dark: rgba(255, 255, 255, 0.15);
  --mobile-glass-bg-light: rgba(255, 255, 255, 0.85);
  --mobile-glass-bg-dark: rgba(26, 34, 52, 0.85);
  
  /* Font */
  --tblr-font-sans-serif: 'Inter Var', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Base Reset & Layout */
html, body {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-family: var(--tblr-font-sans-serif);
  -webkit-tap-highlight-color: transparent;
  background-color: var(--tblr-bg-surface, #f6f8fb);
}

[data-bs-theme="dark"] html,
[data-bs-theme="dark"] body {
  background-color: #0f172a;
  color: #f4f6fa;
}

/* App Containers */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  position: relative;
  overflow: hidden;
}

.app-header {
  height: var(--app-header-height);
  padding-top: var(--safe-area-top);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1030;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
}

[data-bs-theme="dark"] .app-header {
  background: #1e293b;
  border-bottom-color: #334155;
}

.app-content {
  flex: 1;
  margin-top: var(--app-header-height);
  margin-bottom: var(--app-nav-height);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1.5rem 1.25rem calc(2.5rem + var(--safe-area-bottom)); /* Increased bottom padding */
}

/* Bottom Navigation Bar */
.app-nav {
  height: var(--app-nav-height);
  padding-bottom: var(--safe-area-bottom);
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1030;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-around;
  align-items: center;
}

[data-bs-theme="dark"] .app-nav {
  background: #1e293b;
  border-top-color: #334155;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 100%;
  color: #8a94a6;
  text-decoration: none;
  font-size: 0.62rem;
  font-weight: 500;
  transition: all 0.2s ease;
  position: relative;
  letter-spacing: 0.2px;
  cursor: pointer;
}

[data-bs-theme="dark"] .nav-item {
  color: #64748b;
}

.nav-item i {
  font-size: 1.25rem;
  margin-bottom: 3px;
  transition: all 0.2s ease;
}

.nav-item.active {
  color: var(--mobile-primary);
  font-weight: 600;
}

.nav-item.active i {
  transform: translateY(-1px);
}

.btn-active-scale:active,
.nav-item:active {
  transform: scale(0.96);
  opacity: 0.8;
}

/* Tab Transitions */
.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

/* Styled Cards */
.mobile-card {
  background: #ffffff;
  border: 1px solid var(--mobile-card-border-light);
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  padding: 1rem;
  margin-bottom: 0.75rem;
  transition: all 0.2s ease;
}

[data-bs-theme="dark"] .mobile-card {
  background: #1e293b;
  border-color: var(--mobile-card-border-dark);
}

/* Dashboard Summary Card */
.summary-card {
  background: linear-gradient(135deg, #206bc4 0%, #1a569d 100%);
  border-radius: 20px;
  padding: 1.5rem;
  color: #ffffff;
  margin-bottom: 1.5rem;
  box-shadow: 0 10px 25px rgba(32, 107, 196, 0.2);
  position: relative;
  overflow: hidden;
}

.summary-card::before {
  content: '';
  position: absolute;
  top: -50px;
  right: -50px;
  width: 150px;
  height: 150px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
}

.progress-premium {
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  margin: 1rem 0 0.5rem 0;
  overflow: hidden;
}

.progress-premium-bar {
  height: 100%;
  background: #ffffff;
  border-radius: 10px;
  transition: width 0.5s ease;
}

/* Quick Actions Grid */
.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 1.5rem;
}

.quick-action-card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 16px;
  padding: 1rem;
  text-align: center;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

[data-bs-theme="dark"] .quick-action-card {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.08);
}

.quick-action-card:active {
  transform: scale(0.95);
  background-color: rgba(32, 107, 196, 0.04);
}

.quick-action-card i {
  font-size: 1.5rem;
  margin-bottom: 8px;
  color: var(--tblr-primary);
  display: block;
}

.quick-action-card span {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
}

[data-bs-theme="dark"] .quick-action-card span {
  color: #94a3b8;
}

.stat-mini-card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 16px;
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 12px;
}

[data-bs-theme="dark"] .stat-mini-card {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.08);
}

/* Calendar Styling */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    text-align: center;
}

.calendar-day {
    aspect-ratio: 1/1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.calendar-day.today {
    border: 2px solid var(--mobile-primary);
}

.calendar-day.active {
    background: var(--mobile-primary);
    color: white;
}

.calendar-day.weekend {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* Login Page Styling */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f4f6f9;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow: hidden;
}

[data-bs-theme="dark"] .login-screen {
    background-color: #0f172a;
}

/* Blob Backgrounds */
.bg-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 1;
    opacity: 0.6;
}
.bg-blob-primary {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(32, 107, 196, 0.2) 0%, rgba(32, 107, 196, 0) 70%);
    top: -100px;
    left: -100px;
}
.bg-blob-indigo {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, rgba(99, 102, 241, 0) 70%);
    bottom: -100px;
    right: -100px;
}

.login-container {
    width: 100%;
    max-width: 400px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 2.5rem 1.75rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    z-index: 10;
    position: relative;
    animation: fadeIn 0.4s ease-out forwards;
}

[data-bs-theme="dark"] .login-container {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.login-subtitle {
    font-size: 0.875rem;
    color: #64748b;
}

.form-floating > .form-control {
    border-radius: 8px;
    background-color: #ffffff;
    border: 1px solid #d1d5db;
    color: inherit;
}

[data-bs-theme="dark"] .form-floating > .form-control {
    background-color: #0f172a;
    border-color: #334155;
}

.form-floating > .form-control:focus {
    background-color: #ffffff;
    border-color: #206bc4;
    box-shadow: 0 0 0 4px rgba(32, 107, 196, 0.08);
}

[data-bs-theme="dark"] .form-floating > .form-control:focus {
    background-color: #0f172a;
}

.form-floating > label {
    color: #64748b;
}

[data-bs-theme="dark"] .form-floating > label {
    color: #94a3b8;
}

.form-select {
    border-radius: 8px;
    border-color: #d1d5db;
}

[data-bs-theme="dark"] .form-select {
    background-color: #0f172a;
    border-color: #334155;
    color: #f1f5f9;
}

.login-middle-form {
    margin: 1.25rem 0;
}

.btn-login {
    border-radius: 14px;
    padding: 0.85rem 1.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    background: linear-gradient(135deg, #206bc4 0%, #1a569d 100%);
    border: none;
    box-shadow: 0 8px 24px rgba(32, 107, 196, 0.2);
    transition: all 0.25s ease;
    color: white;
}

.btn-login:hover {
    background: linear-gradient(135deg, #2475d7 0%, #1d61b3 100%);
    box-shadow: 0 10px 28px rgba(32, 107, 196, 0.3);
    transform: translateY(-1px);
    color: white;
}

.hover-underline {
    transition: color 0.2s ease;
    font-weight: 500;
}
.hover-underline:hover {
    color: var(--mobile-primary) !important;
    text-decoration: underline !important;
}

@media (max-width: 480px) {
    .login-screen {
        background-color: #ffffff;
        padding: 0;
        align-items: stretch;
    }
    
    [data-bs-theme="dark"] .login-screen {
        background-color: #0f172a;
    }

    .bg-blob {
        display: none;
    }
    .login-container {
        max-width: 100%;
        min-height: 100dvh;
        border-radius: 0;
        border: none;
        box-shadow: none;
        background: #ffffff;
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: 2rem 1.75rem;
    }

    [data-bs-theme="dark"] .login-container {
        background: #0f172a;
    }
}

/* FAB */
.mobile-fab {
  position: fixed;
  right: 1.25rem;
  bottom: calc(var(--app-nav-height) + 1.25rem);
  width: 56px;
  height: 56px;
  border-radius: 28px;
  background-color: var(--mobile-primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(32, 107, 196, 0.4);
  text-decoration: none;
  z-index: 1020;
  border: none;
  transition: transform 0.2s ease;
}

.mobile-fab:active {
  transform: scale(0.9);
}

/* SweetAlert2 Premium Mobile Style */
.swal2-container {
    z-index: 10000 !important;
    backdrop-filter: blur(4px);
}

.swal2-popup {
    border-radius: 24px !important;
    padding: 2rem 1.5rem !important;
    font-family: var(--tblr-font-sans-serif) !important;
    border: none !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15) !important;
    background-color: #ffffff !important;
    color: #1e293b !important;
    width: 90% !important;
    max-width: 380px !important;
}

[data-bs-theme="dark"] .swal2-popup {
    background-color: #1a2234 !important;
    color: #f4f6fa !important;
}

.swal2-title {
    font-size: 1.4rem !important;
    font-weight: 700 !important;
    color: inherit !important;
    text-align: center !important;
    padding: 0 !important;
    margin: 0 0 0.75rem 0 !important;
    letter-spacing: -0.5px !important;
}

.swal2-html-container {
    font-size: 0.95rem !important;
    color: #64748b !important;
    text-align: center !important;
    margin: 0 0 1.5rem 0 !important;
    padding: 0 0.5rem !important;
    line-height: 1.5 !important;
}

[data-bs-theme="dark"] .swal2-html-container {
    color: #94a3b8 !important;
}

.swal2-actions {
    display: flex !important;
    flex-direction: row-reverse !important; /* Confirm right, Cancel left */
    justify-content: center !important;
    gap: 12px !important;
    width: 100% !important;
    margin: 0.5rem 0 0 0 !important;
    padding: 0 !important;
}

.swal2-styled.swal2-confirm,
.swal2-styled.swal2-cancel {
    border-radius: 14px !important;
    font-weight: 600 !important;
    font-size: 0.95rem !important;
    padding: 0.8rem 1.5rem !important;
    margin: 0 !important;
    box-shadow: none !important;
    flex: 1;
    max-width: 160px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    white-space: nowrap !important;
}

.swal2-styled.swal2-confirm {
    background-color: #1e293b !important; /* Dark button like screenshot */
    color: #ffffff !important;
    border: none !important;
}

[data-bs-theme="dark"] .swal2-styled.swal2-confirm {
    background-color: #f4f6fa !important;
    color: #1a2234 !important;
}

.swal2-styled.swal2-cancel {
    background-color: #ffffff !important;
    color: #64748b !important;
    border: 1px solid #e2e8f0 !important;
}

[data-bs-theme="dark"] .swal2-styled.swal2-cancel {
    background-color: transparent !important;
    border-color: #334155 !important;
    color: #94a3b8 !important;
}

.swal2-icon {
    margin: 0 auto 1.25rem auto !important;
    transform: scale(0.9);
}

/* Profile Page Enhancements */
.profile-cover {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-radius: 24px;
  padding: 2rem 1.5rem;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.03);
}

[data-bs-theme="dark"] .profile-cover {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-color: rgba(255, 255, 255, 0.05);
}

.profile-cover::after {
  content: '';
  position: absolute;
  top: -30px;
  right: -30px;
  width: 100px;
  height: 100px;
  background: var(--tblr-primary);
  opacity: 0.03;
  border-radius: 50%;
}

.profile-action-btn {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 16px;
  padding: 1.25rem 1rem;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
  color: inherit;
  text-decoration: none;
}

[data-bs-theme="dark"] .profile-action-btn {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.08);
}

.profile-action-btn:active {
  transform: scale(0.96);
  background-color: #f8fafc;
}

[data-bs-theme="dark"] .profile-action-btn:active {
  background-color: #0f172a;
}

.profile-action-btn i {
  font-size: 1.5rem;
}

.profile-info-list {
  background: #ffffff;
  border-radius: 20px;
  padding: 0.5rem 1.25rem;
  border: 1px solid rgba(0, 0, 0, 0.04);
}

[data-bs-theme="dark"] .profile-info-list {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.08);
}

.profile-info-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 1rem 0;
}

.profile-info-item:not(:last-child) {
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

[data-bs-theme="dark"] .profile-info-item:not(:last-child) {
  border-bottom-color: rgba(255, 255, 255, 0.05);
}

.profile-info-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  color: #64748b;
  flex-shrink: 0;
}

[data-bs-theme="dark"] .profile-info-icon {
  background: #0f172a;
  color: #94a3b8;
}

.btn-logout-premium {
    color: #ef4444;
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 1rem;
    width: 100%;
    background: transparent;
    border: none;
    transition: all 0.2s;
}

.btn-logout-premium:active {
    opacity: 0.6;
    transform: scale(0.98);
}

/* Bottom Sheet Modal Styling */
.modal-bottom-sheet {
    display: none;
}

.modal-bottom-sheet.show {
    display: flex !important;
    align-items: flex-end !important;
    justify-content: center !important;
    padding: 0 !important;
}

/* Ensure dialog starts off-screen */
.modal-bottom-sheet .modal-dialog {
    margin: 0 !important;
    width: 100% !important;
    max-width: 500px !important;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Slide up when shown */
.modal-bottom-sheet.show .modal-dialog {
    transform: translateY(0) !important;
}

/* Force slide down when closing */
.modal-bottom-sheet.fade:not(.show) .modal-dialog {
    transform: translateY(100%) !important;
}

.modal-bottom-sheet .modal-content {
    border-radius: 24px 24px 0 0 !important;
    border: none !important;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15) !important;
    margin: 0 !important;
    padding-bottom: env(safe-area-inset-bottom, 20px) !important;
    width: 100%;
}

/* Swipe-to-Delete Styling */
.swipe-item {
    position: relative !important;
    overflow: hidden !important;
    border-radius: 0 !important;
    margin-bottom: 0 !important;
    background: transparent !important;
    display: block !important;
}

[data-bs-theme="dark"] .swipe-item {
    background: #1e293b !important;
}

.swipe-content {
    position: relative;
    z-index: 2;
    background: #ffffff !important;
    border: none;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 0 !important;
    padding: 1.25rem !important;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    align-items: center;
    width: 100%;
}

[data-bs-theme="dark"] .swipe-content {
    background: #1e293b !important;
    border-color: rgba(255, 255, 255, 0.05);
}

.swipe-actions {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    width: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    background: #ef4444 !important;
    height: 100%;
}

.btn-swipe-delete {
    background: none;
    border: none;
    color: #fff;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.modal-bottom-sheet .modal-header {
    border-bottom: none !important;
    padding: 1.5rem 1.5rem 0.5rem !important;
    justify-content: center;
    position: relative;
    background: transparent;
}

/* Pull Handle */
.modal-bottom-sheet .modal-header::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    background: #cbd5e1;
    border-radius: 4px;
}

body[data-bs-theme="dark"] .modal-bottom-sheet .modal-header::before {
    background: #475569;
}

.modal-bottom-sheet .modal-title {
    font-weight: 800;
    font-size: 1.25rem;
    text-align: center;
    width: 100%;
    color: inherit;
}

.modal-bottom-sheet .btn-close {
    position: absolute;
    right: 1.25rem;
    top: 1.25rem;
    background-color: rgba(0,0,0,0.05);
    border-radius: 50%;
    padding: 0.5rem;
    margin: 0;
}

body[data-bs-theme="dark"] .modal-bottom-sheet .btn-close {
    background-color: rgba(255,255,255,0.1);
}

/* Loading Shimmer Effect */
.shimmer {
    background: #f1f5f9;
    background-image: linear-gradient(90deg, #f1f5f9 0%, #e2e8f0 50%, #f1f5f9 100%);
    background-repeat: no-repeat;
    background-size: 200% 100%; 
    display: inline-block;
    position: relative; 
    animation: placeholderShimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

[data-bs-theme="dark"] .shimmer {
    background: #1e293b;
    background-image: linear-gradient(90deg, #1e293b 0%, #334155 50%, #1e293b 100%);
}

@keyframes placeholderShimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

.calendar-skeleton {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 12px;
    padding: 10px 0;
}

.calendar-skeleton-item {
    aspect-ratio: 1/1;
    width: 100%;
    max-width: 42px;
    margin: auto;
}

.italic {
    font-style: italic;
}

.divide-y > * + * {
    border-top: 1px solid #f1f5f9;
}

body[data-bs-theme="dark"] .divide-y > * + * {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.extra-small {
    font-size: 0.7rem;
}

/* Global Override for Tabler's .divide-y padding issue */
.divide-y > :not(template):not(:last-child) {
    padding-bottom: 0 !important;
}

.divide-y > :not(template):not(:first-child) {
    padding-top: 0 !important;
}

