/* =========================================
   PART 1: EXACT COLORS, RESET & LOGIN SCREEN
   ========================================= */

:root {
    /* Exact colors pulled from your reference image */
    --bg-main: #0B0E17;       /* Very dark navy for the outer background */
    --bg-card: #161B26;       /* Slightly lighter navy for the form container */
    --text-main: #FFFFFF;     /* White text for labels */
    --text-muted: #9CA3AF;    /* Grey text for placeholders/dates */
    --input-bg: #C5C9D1;      /* The exact silver/grey of the input boxes */
    --input-text: #000000;    /* Black text inside inputs */
    --btn-gold: #D2AD7D;      /* The gold/tan of the main submit button */
    --btn-red: #FE8A8A;       /* Pastel red for "Not Returned" */
    --btn-green: #89E077;     /* Pastel green for "Returned" */
    
    /* Strict layout measurements */
    --radius: 8px;
    --spacing-sm: 8px;
    --spacing-md: 12px;
    --spacing-lg: 16px;
}

/* Base Reset to prevent mobile zooming and scrolling bugs */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    touch-action: manipulation; /* Disables 300ms tap delay */
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: system-ui, -apple-system, sans-serif;
    padding: var(--spacing-sm); /* 8px padding around the entire screen */
    overflow-x: hidden;
}

/* =========================================
   SECURE LOGIN OVERLAY
   ========================================= */

.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-main);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999; /* Forces this to stay on top of everything */
}

.login-card {
    background-color: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius);
    width: 90%;
    max-width: 350px; /* Caps the width at 350px so it stays compact */
    text-align: center;
    border: 1px solid #2A3143; /* Subtle border to separate from background */
}

.login-card h2 {
    font-size: 20px;
    margin-bottom: var(--spacing-sm);
}

.login-card p {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: var(--spacing-lg);
}

.login-card input {
    width: 100%;
    height: 48px; /* Strict 48px height for thumb tapping */
    border-radius: var(--radius);
    border: none;
    background-color: var(--input-bg);
    color: var(--input-text);
    font-size: 18px; /* 18px text to prevent Safari auto-zoom */
    text-align: center;
    margin-bottom: var(--spacing-lg);
    font-weight: bold;
    outline: none;
}

.login-card input:focus {
    box-shadow: 0 0 0 2px var(--btn-gold); /* Gold ring when typing */
}

/* The "hidden" class will be used by JavaScript to remove the login screen */
.hidden {
    display: none !important;
}



/* =========================================
   PART 2: DASHBOARD HEADER & COMPACT FORM
   ========================================= */

.dashboard {
    width: 100%;
    max-width: 600px; /* Caps the layout at 600px so it doesn't stretch on PCs */
    margin: 0 auto; 
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md); /* 12px space between header, form, and data list */
}

/* 1. Header Layout */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) 0; /* 8px top and bottom, 0px sides */
}

.top-bar h1 {
    font-size: 1.25rem; /* 20px font */
    color: var(--btn-gold);
    font-weight: bold;
}

.btn-icon {
    background: transparent;
    border: 1px solid var(--btn-gold); /* 1px gold border */
    color: var(--btn-gold);
    padding: 6px 12px; /* 6px top/bottom, 12px sides */
    border-radius: var(--radius); /* 8px curves */
    font-size: 0.875rem; /* 14px font */
    cursor: pointer;
}

/* 2. Form Section & 2-Column Grid */
.form-section {
    background-color: var(--bg-card);
    padding: var(--spacing-md); /* 12px padding inside the card */
    border-radius: var(--radius); /* 8px curves */
    border: 1px solid #2A3143; 
}

.compact-form {
    display: grid;
    /* This creates exactly 2 equal columns to save massive vertical space */
    grid-template-columns: 1fr 1fr; 
    gap: var(--spacing-md); /* 12px gap between all inputs */
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 4px; /* 4px spacing between the label text and the input box */
}

.input-group label {
    font-size: 0.75rem; /* 12px font - very small to save space */
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group input {
    height: 40px; /* Compressed 40px height to save vertical pixels */
    border-radius: 4px; /* 4px subtle curve */
    border: none;
    background-color: var(--input-bg);
    color: var(--input-text);
    padding: 0 10px; /* 0px top/bottom, 10px padding on the sides */
    font-size: 0.9375rem; /* 15px text */
    outline: none;
    font-weight: 500;
}

/* Target the specific Date/Time input to ensure it fits the box */
input[type="datetime-local"] {
    font-size: 0.85rem; /* 13.6px font to ensure the full date string fits without cutting off */
    padding: 0 4px; /* Reduced 4px padding so the time doesn't get pushed out of frame */
}

.input-group input:focus {
    box-shadow: 0 0 0 2px var(--btn-gold); /* 2px gold highlight when typing */
}

/* 3. Submit Button */
.btn-submit {
    grid-column: 1 / -1; /* Forces the button to stretch across both columns */
    background-color: var(--btn-gold);
    color: #000000;
    border: none;
    height: 44px; /* 44px height for a solid tap target */
    border-radius: var(--radius); /* 8px curves */
    font-size: 1rem; /* 16px text */
    font-weight: bold;
    cursor: pointer;
    margin-top: 4px; /* 4px push down from the inputs */
}



/* =========================================
   PART 3: COMPACT DATA TABLE & TOGGLES
   ========================================= */

.data-section {
    background-color: var(--bg-card);
    padding: var(--spacing-md); /* 12px padding inside the container */
    border-radius: var(--radius); /* 8px curves */
    border: 1px solid #2A3143;
}

.section-header {
    margin-bottom: var(--spacing-md); /* 12px gap before the table starts */
    text-align: right; /* Aligned right to match the visual flow of your image */
}

/* The gold underline from your image.png */
.title-underline {
    font-size: 1.125rem; /* 18px text */
    color: var(--btn-gold);
    border-bottom: 2px solid var(--btn-gold); /* 2px strict gold line */
    display: inline-block;
    padding-bottom: 4px; /* 4px gap between text and line */
}

/* 5-Column Grid Setup (Header and Rows use the exact same grid to align) */
.table-header, .data-row {
    display: grid;
    /* This perfectly splits the screen: 2 parts Name, 2 parts Item, 2.5 parts Phone, 2 parts Date, and exactly 75px for the button */
    grid-template-columns: 2fr 2fr 2.5fr 2fr 75px; 
    gap: 4px; /* 4px strict gap so data text doesn't bleed into the next column */
    align-items: center;
    text-align: center;
}

.table-header {
    font-size: 0.65rem; /* 10.4px font - extremely small to save vertical space */
    color: var(--btn-gold); /* Matching the gold header text from the image */
    padding-bottom: 8px; /* 8px bottom padding */
    border-bottom: 1px solid #2A3143; /* 1px separator line */
    margin-bottom: 8px; /* 8px gap before the first row of data */
    text-transform: uppercase;
}

/* The individual rows (Injected later via JS) */
.data-row {
    padding: 8px 0; /* 8px top/bottom, 0px sides to keep rows thin */
    border-bottom: 1px solid #1f2533; /* Very subtle 1px line between rows */
    font-size: 0.75rem; /* 12px font - big enough to read, small enough to fit */
    color: var(--text-main);
}

/* Forces text to cut off with "..." if a customer has a very long name */
.data-row div {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Action Button / Toggle Status */
.btn-toggle {
    width: 100%;
    height: 28px; /* 28px height - very compact so it fits perfectly inside a thin row */
    border: none;
    border-radius: 4px; /* 4px slight curves */
    font-size: 0.65rem; /* 10.4px text to fit inside the small button */
    font-weight: bold;
    cursor: pointer;
    color: #000000; /* Solid black text for maximum contrast against the pastel colors */
}

.status-returned {
    background-color: var(--btn-green); /* The pastel green from the image */
}

.status-active {
    background-color: var(--btn-red); /* The pastel red from the image */
}

/* Empty state & Pagination Controls */
.empty-msg {
    text-align: center;
    padding: 20px 0; /* 20px padding to center the text when no data exists */
    color: var(--text-muted);
    font-size: 0.875rem; /* 14px */
}

.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px; /* 16px gap below the list */
    padding-top: 16px;
    border-top: 1px solid #2A3143; /* 1px top line to separate controls from data */
}

.btn-page {
    background: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text-muted);
    padding: 4px 12px; /* 4px top/bottom, 12px sides */
    border-radius: 4px; /* 4px curves */
    cursor: pointer;
    font-size: 0.75rem; /* 12px text */
}

.btn-page:disabled {
    opacity: 0.3; /* Fades the button to 30% visibility if there are no more pages */
    cursor: not-allowed;
}
/* =========================================
   SMOOTH MODAL EFFECTS
   ========================================= */
#confirmation-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px); /* Clean glass effect */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.25s ease;
}

/* Hides the modal completely when not active */
#confirmation-modal.modal-hidden {
    opacity: 0;
    pointer-events: none;
}

/* The white box with a bouncy scale effect */
.modal-content {
    background: white;
    padding: 24px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    width: 300px;
    transform: scale(1) translateY(0);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#confirmation-modal.modal-hidden .modal-content {
    transform: scale(0.9) translateY(20px);
}

.modal-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
}

.modal-actions button {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cancel {
    background: #f1f1f1;
    color: #555;
}
.btn-cancel:hover { background: #e4e4e4; }

.btn-confirm {
    background: #4CAF50;
    color: white;
}
.btn-confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}