/* =========================================
   General Page Styling (Modern Theme)
========================================= */
:root {
  --primary-color: #007bff;
  --secondary-color: #6c757d;
  --success-color: #28a745;
  --danger-color: #dc3545;
  --background-light: #f8f9fa;
  --background-dark: #1f2833;
  --card-light: #ffffff;
  --card-dark: #2c3a47;
  --text-light: #212529;
  --text-dark: #f8f9fa;
  --border-color: #dee2e6;
  --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  --shadow-md: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  background: var(--background-light);
  color: var(--text-light);
  transition: all 0.3s ease;
  min-height: 100vh;
}

header {
  background: var(--primary-color);
  color: white;
  padding: 15px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-md);
}

header h1 {
  margin: 0;
  font-size: 1.8rem;
}

nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

nav a, nav button {
  color: white;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 5px;
  transition: background-color 0.2s;
  background: none;
  border: none;
  cursor: pointer;
}

nav a:hover, nav button:hover {
  background-color: rgba(255, 255, 255, 0.15);
}

#adminInfo {
  margin-left: 15px;
  font-size: 0.9rem;
  opacity: 0.8;
}

section {
  padding: 30px;
  background: var(--card-light);
  margin: 20px auto;
  max-width: 1200px;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

h2 {
  color: var(--primary-color);
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 10px;
  margin-top: 0;
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="file"],
select {
  width: 100%;
  padding: 10px;
  margin-bottom: 15px;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  box-sizing: border-box;
}

/* =========================================
   Buttons
========================================= */
.primary-btn, .secondary-btn, .success-btn, .danger-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 600;
  transition: background-color 0.2s, box-shadow 0.2s;
}
.small-btn { padding: 5px 10px; font-size: 0.8rem; }

.primary-btn { background-color: var(--primary-color); color: white; }
.primary-btn:hover { background-color: #0056b3; }

.secondary-btn { background-color: var(--secondary-color); color: white; }
.secondary-btn:hover { background-color: #5a6268; }

.success-btn { background-color: var(--success-color); color: white; }
.success-btn:hover { background-color: #1e7e34; }

.danger-btn { background-color: var(--danger-color); color: white; }
.danger-btn:hover { background-color: #bd2130; }


/* =========================================
   Login Page Title & Layout (NEW)
========================================= */
.main-title-container {
    text-align: center;
    margin-top: 50px;
    margin-bottom: 20px;
    padding: 0 10px;
}
.main-title-container h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    font-weight: 800;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    margin: 0;
}
.login-container { 
  max-width: 400px; 
  background: var(--card-light); 
  margin: 0 auto 100px auto; 
  padding: 35px; 
  border-radius: 10px; 
  box-shadow: var(--shadow-md); 
}
.login-container h2 {
    text-align: center;
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 20px;
}
.login-container input { width: 100%; }
.login-container button { width: 100%; margin-top: 10px; }
.toggle-link {
    text-align: center;
    color: var(--primary-color);
    cursor: pointer;
    margin-top: 15px;
    font-size: 0.9rem;
}
.info { font-size: 0.8rem; color: var(--secondary-color); text-align: center; }

/* =========================================
   Inventory/Documents Common Controls
========================================= */

/* New / Updated .product-bar Styling (Responsive Vertical/Horizontal) */
.product-bar {
    display: grid;
    /* On large screens, create a responsive grid with minimum column size */
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px; 
    align-items: center; 
    margin-bottom: 20px; 
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #f1f7fe; /* Light background for the bar */
}

.product-bar input { 
    width: 100%; 
    margin: 0;
}

/* Make the Add Product button span across the full width of the bar on smaller screens */
.product-bar button {
    grid-column: 1 / -1; 
    padding: 12px 15px;
}

/* Adjust button column span only on wider views to prevent it from spanning all columns */
@media (min-width: 768px) {
    .product-bar button {
        /* Let the button only take the last column on larger screens */
        grid-column: auto; 
        min-width: 150px;
    }
}


.controls { 
    display:flex; 
    justify-content:space-between; 
    gap:15px; 
    flex-wrap:wrap; 
    align-items:center; 
    margin-bottom: 20px;
}
.search-controls { display: flex; gap: 8px; }
#searchInput, #searchDocs { width: 280px; padding: 10px; }

/* =========================================
   Inventory Table Styling
========================================= */
.inventory-table-container {
    overflow-x: auto;
    width: 100%;
    margin-bottom: 20px;
}
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
  background: var(--card-light);
}

th, td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

th {
  background-color: var(--primary-color);
  color: white;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.9rem;
}

tr:hover {
  background-color: #f1f1f1;
}

.money {
    font-weight: 600;
    color: var(--success-color);
}
.actions button { margin-right: 5px; }

.out-of-stock-row { background-color: #ffe0e0; }
.low-stock-row { background-color: #fff9e0; }


.totals {
  display: flex;
  justify-content: flex-end;
  gap: 30px;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 15px;
  border-top: 2px solid var(--primary-color);
  background: #f1f7fe;
  border-radius: 0 0 8px 8px;
}


/* =========================================
   Dashboard Styling
========================================= */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}
@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.dashboard-card-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.info-card {
    background: #f1f7fe;
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

.quick-access-btn {
    display: block;
    text-align: center;
    padding: 15px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
    transition: transform 0.2s;
    background: var(--primary-color);
    color: white;
}
.quick-access-btn:hover {
    background: #0056b3;
    transform: translateY(-2px);
}
.clock {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--danger-color);
    margin: 15px 0;
}

/* NEW: Dashboard Summary Card Styling */
.inventory-summary-card {
    background: #e6f3ff; 
    border: 1px solid #b3d9ff;
    color: var(--text-light);
}
.inventory-summary-card ul {
    list-style: none;
    padding-left: 0;
}
.inventory-summary-card li {
    padding: 5px 0;
    font-size: 1.1rem;
    font-weight: 500;
}

/* =========================================
   Document List
========================================= */
#docList {
  list-style: none;
  padding: 0;
}
#docList li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  border: 1px solid var(--border-color);
  margin-bottom: 8px;
  border-radius: 5px;
  background: #f9f9f9;
}


/* =========================================
   Activity Log
========================================= */
#logList { list-style: none; padding: 0; }
#logList li {
  padding: 10px;
  background: #e9ecef;
  margin: 8px 0;
  border-left: 4px solid var(--primary-color);
  border-radius: 4px;
}


/* =========================================
   Settings Page Styling (NEW)
========================================= */
.settings-form {
    max-width: 500px;
    margin: 20px auto;
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fdfdfd;
}

.settings-form label {
    display: block;
    margin-top: 15px;
    font-weight: 600;
}
.settings-form input {
    margin-bottom: 5px;
}
#changePasswordBtn {
    margin-top: 20px;
    width: 100%;
}
.settings-actions {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    max-width: 500px;
    margin: 30px auto;
}
.settings-actions button {
    flex: 1;
}
.form-message {
    text-align: center;
    margin-top: 10px;
}

/* =========================================
   Dark Mode
========================================= */
.dark-mode {
  background: var(--background-dark);
  color: var(--text-dark);
}

.dark-mode header {
  background: #0056b3;
}
.dark-mode .main-title-container h1 {
    color: var(--text-dark);
    text-shadow: 2px 2px 4px rgba(0, 123, 255, 0.2);
}

.dark-mode section, 
.dark-mode .login-container,
.dark-mode table,
.dark-mode #docList li,
.dark-mode .settings-form {
  background: var(--card-dark);
  color: var(--text-dark);
  box-shadow: var(--shadow-md);
}
.dark-mode .inventory-summary-card {
    background: #1a3a5b; 
    border-color: #004a80;
    color: var(--text-dark);
}

.dark-mode input, .dark-mode select {
    background: #495057;
    color: var(--text-dark);
    border-color: #6c757d;
}
.dark-mode input:focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.5);
}

.dark-mode th { background-color: #0056b3; }
.dark-mode tr:hover { background-color: #3b4e60; }
.dark-mode .out-of-stock-row { background-color: #4f2d30; }
.dark-mode .low-stock-row { background-color: #4f462d; }
.dark-mode .totals { background: #3b4e60; border-top-color: #0056b3; }
.dark-mode .product-bar { background: #3b4e60; }

.dark-mode #logList li {
  background: #3b4e60;
  border-left-color: var(--primary-color);
}