/* Kriha Rental Management System - Pure CSS */
:root {
    /* Color Variables */
    --logo-color: #5F3DC4;
    --logo-light: #7f5ed1;
    --logo-dark: #4a2f9a;
    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    /* Spacing */
    --spacing-1: 0.25rem;
    --spacing-2: 0.5rem;
    --spacing-3: 0.75rem;
    --spacing-4: 1rem;
    --spacing-5: 1.25rem;
    --spacing-6: 1.5rem;
    --spacing-8: 2rem;
    
    /* Border Radius */
    --rounded-sm: 0.125rem;
    --rounded: 0.25rem;
    --rounded-md: 0.375rem;
    --rounded-lg: 0.5rem;
    --rounded-full: 9999px;
}

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

/* Hide scrollbar globally */
* {
    -ms-overflow-style: none;  /* Internet Explorer 10+ */
    scrollbar-width: none;  /* Firefox */
}

*::-webkit-scrollbar {
    display: none;  /* Safari and Chrome */
}

/* Hide scrollbar for sidebar */
.scrollbar-hide {
    -ms-overflow-style: none;  /* Internet Explorer 10+ */
    scrollbar-width: none;  /* Firefox */
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;  /* Safari and Chrome */
}

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.5;
    color: var(--gray-800);
    background-color: var(--white);
}

/* Layout */
.auth-container {
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-6);
    background-color: var(--white);
}

.auth-card {
    width: 100%;
    max-width: 28rem;
    background-color: var(--white);
    border-radius: var(--rounded-lg);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: var(--spacing-8);
}

/* Form Elements */
.form-group {
    margin-bottom: var(--spacing-6);
    position: relative;
}

.form-label {
    display: block;
    margin-bottom: var(--spacing-2);
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--gray-700);
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: var(--gray-900);
    background-color: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: var(--rounded-md);
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    border-color: var(--logo-light);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(95, 61, 196, 0.25);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    font-weight: 500;
    text-align: center;
    border-radius: var(--rounded-md);
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    border: 1px solid transparent;
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.btn-primary {
    background-color: var(--logo-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--logo-dark);
}

.btn-block {
    display: block;
    width: 100%;
}

/* Logo */
.auth-logo {
    display: flex;
    justify-content: center;
    margin-bottom: var(--spacing-8);
}

.auth-logo img {
    height: 6rem;
    width: auto;
}

/* Text */
.text-center {
    text-align: center;
}

.text-sm {
    font-size: 0.875rem;
}

/* Utilities */
.w-full {
    width: 100%;
}

.mb-4 {
    margin-bottom: var(--spacing-4);
}

.mb-6 {
    margin-bottom: var(--spacing-6);
}

/* Responsive */
@media (max-width: 640px) {
    .auth-card {
        padding: var(--spacing-6) var(--spacing-4);
    }
}

/* Sidebar Animation - Clean and Simple */
#mobile-sidebar {
    /* Ensure proper stacking */
    z-index: 40;
}

#sidebar-panel {
    /* Hardware acceleration for smooth animation */
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

#sidebar-panel:not(.transform.-translate-x-full) {
    transform: translateX(0);
}

#sidebar-backdrop {
    /* Simple backdrop with fade effect */
    background-color: rgba(0, 0, 0, 0.5);
    transition: opacity 0.3s ease-out;
}

/* Prevent body scroll when sidebar is open */
body.sidebar-open {
    overflow: hidden;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    #sidebar-panel {
        -webkit-transform: translateX(-100%);
        -webkit-transition: -webkit-transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    #sidebar-panel:not(.transform.-translate-x-full) {
        -webkit-transform: translateX(0);
    }
}

/* ============================================================
   RESPONSIVE LAYOUT — Mobile & Tablet
   ============================================================ */

/* Ensure full-height layout on all devices */
html, body {
    min-height: 100%;
    min-height: 100dvh; /* dynamic viewport height — iOS Safari safe */
}

/* Main content wrapper: fill available height without sidebar on mobile/tablet */
.lg\:pl-64 {
    min-height: 100dvh;
}

/* Safe area insets for phones with home indicator / notch */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    body {
        padding-bottom: env(safe-area-inset-bottom);
    }
    main {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    }
}

/* ============================================================
   TOUCH TARGETS — Minimum 44px tap area for accessibility
   ============================================================ */
#sidebar-container nav a,
#mobile-sidebar nav a,
#sidebar-container .dropdown-button,
#mobile-sidebar .dropdown-button {
    min-height: 44px;
    display: flex;
    align-items: center;
}

/* ============================================================
   SIDEBAR PANEL — Wider on tablet, full-width on small phones
   ============================================================ */
@media (max-width: 359px) {
    /* Very small phones: slightly narrower panel */
    #sidebar-panel {
        width: 88vw;
        max-width: 300px;
    }
}

@media (min-width: 640px) and (max-width: 1023px) {
    /* Tablet: wider panel */
    #sidebar-panel {
        width: 300px;
    }
}

/* ============================================================
   TOP NAVIGATION BAR — Mobile refinements
   ============================================================ */
@media (max-width: 639px) {
    /* Prevent title overflow on very small screens */
    .lg\:pl-64 > div:first-child h1 {
        font-size: 0.95rem;
        max-width: calc(100vw - 120px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* Open-sidebar button larger tap target */
#open-sidebar {
    padding: 0.625rem;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================================
   RESPONSIVE TABLE COLUMNS
   Utility classes to hide/show table columns at breakpoints.
   Add these to <th> and <td> elements.
   ============================================================ */

/* Hide on mobile, show from sm (640px) */
.col-sm {
    display: none;
}
@media (min-width: 640px) {
    .col-sm {
        display: table-cell;
    }
}

/* Hide on mobile+tablet, show from md (768px) */
.col-md {
    display: none;
}
@media (min-width: 768px) {
    .col-md {
        display: table-cell;
    }
}

/* Hide on mobile+tablet, show from lg (1024px) */
.col-lg {
    display: none;
}
@media (min-width: 1024px) {
    .col-lg {
        display: table-cell;
    }
}

/* ============================================================
   DATA TABLES — Comfortable mobile scrolling
   ============================================================ */
.overflow-x-auto {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}

/* Tighter table cell padding on small screens */
@media (max-width: 639px) {
    table td,
    table th {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}

/* ============================================================
   CARDS & GRIDS — Mobile spacing improvements
   ============================================================ */
@media (max-width: 639px) {
    /* Dashboard stat cards: reduce padding on very small phones */
    .grid .bg-white.shadow.rounded-lg.p-6,
    .grid .bg-white.dark\:bg-gray-800.shadow.rounded-lg.p-6 {
        padding: 1rem;
    }
}

/* ============================================================
   BUTTONS — Better tap targets on mobile
   ============================================================ */
@media (max-width: 639px) {
    .inline-flex.items-center.px-4.py-2 {
        padding-top: 0.625rem;
        padding-bottom: 0.625rem;
    }

    /* Full-width action buttons in page headers on mobile */
    .mb-6.flex.flex-col button,
    .mb-6.flex.flex-col a.inline-flex {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================================
   PAGINATION — Stack on very small screens
   ============================================================ */
@media (max-width: 479px) {
    /* Pagination row: stack info + buttons vertically */
    .mt-6.flex.items-center.justify-between {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }
}

/* ============================================================
   MODALS — Full-screen on mobile
   ============================================================ */
@media (max-width: 639px) {
    /* Make modals use more screen space on phones */
    .fixed.inset-0.z-50.flex.items-center.justify-center > div {
        margin: 1rem;
        max-height: calc(100dvh - 2rem);
        overflow-y: auto;
    }
}

/* ============================================================
   SIDEBAR ACTIVE LINK — Auto-close on mobile nav click
   ============================================================ */
#mobile-sidebar nav a {
    cursor: pointer;
}

/* ============================================================
   SMOOTH SCROLLING
   ============================================================ */
html {
    scroll-behavior: smooth;
}

/* ============================================================
   FOCUS VISIBLE — Accessibility ring only on keyboard nav
   ============================================================ */
*:focus:not(:focus-visible) {
    outline: none;
}
*:focus-visible {
    outline: 2px solid #5F3DC4;
    outline-offset: 2px;
}