/* variables */
:root {
  /* Much darker blue for light mode */
  --indigo: #1a237e; 
  --indigo-text: #1a237e; 
  --indigo-dark: #000051;
  
  --yellow: #ffd600; 
  --yellow-light: #fff9c4;
  --light-bg: #f4f6f8;
  --card-bg: #ffffff;
  --text-main: #333333;
  --text-sec: #666666;
  --border: #e0e0e0;
  --success: #2e7d32; /* Darker green to match */
  --danger: #c62828; /* Darker red */
}

/* dark mode */
body.dark-mode {
  --light-bg: #0a0a0a; /* Darker background */
  --card-bg: #1c1c1c;
  --text-main: #e0e0e0;
  --text-sec: #9e9e9e;
  --border: #333333;
  /* Adjusted blue for dark mode (needs to be visible but still deep) */
  --indigo: #3949ab; 
  --indigo-dark: #283593;
  --indigo-text: #6777dd;
  --yellow-light: #4a4200;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Kanit', sans-serif;
  background: var(--light-bg);
  color: var(--text-main);
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* header & nav */
header {
  background: var(--indigo);
  color: white;
  padding: 15px 20px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.header-content {
  max-width: 1100px; /* Made wider */
  margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center;
}

.header-title {
  font-size: 24px; font-weight: 600; letter-spacing: 1px;
  display: flex; align-items: center; gap: 10px;
}
.header-title::after {
    content: ''; display: block; width: 8px; height: 8px; 
    background: var(--yellow); border-radius: 50%;
}

.header-actions {
  display: flex; gap: 15px; align-items: center;
}

.icon-btn {
  background: rgba(255,255,255,0.15); border: none;
  color: white; width: 40px; height: 40px; border-radius: 50%;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: 0.2s; position: relative;
}
.icon-btn:hover { background: var(--yellow); color: var(--indigo-dark); }

/* dropdown menus */
.dropdown-menu {
  position: absolute; top: 55px; right: 0;
  background: var(--card-bg); color: var(--text-main);
  width: 220px; border-radius: 12px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.2);
  display: none; flex-direction: column; overflow: hidden;
  z-index: 1000; border: 1px solid var(--border);
}
.dropdown-menu.show { display: flex; animation: fadeIn 0.2s; }
.dropdown-item {
  padding: 12px 20px; cursor: pointer; display: flex; align-items: center; gap: 10px;
  font-size: 15px; border-bottom: 1px solid var(--border);
}
.dropdown-item:hover { background: var(--light-bg); }
.dropdown-item:last-child { border-bottom: none; }

/* navigation tabs */
nav {
  display: flex; justify-content: center; background: var(--card-bg);
  padding: 15px; gap: 15px; border-bottom: 1px solid var(--border);
}

nav a {
  cursor: pointer; text-decoration: none; color: var(--text-sec);
  padding: 8px 24px; border-radius: 50px; font-weight: 500;
  transition: 0.3s; background: transparent;
  display: flex; align-items: center; gap: 8px; border: 2px solid transparent;
}
nav a:hover { color: var(--indigo); background: var(--light-bg); }

nav a.active-tab {
  background: var(--indigo); color: white;
  border-color: var(--indigo);
  box-shadow: 0 4px 10px rgba(63, 81, 181, 0.3);
}
/* Yellow accent for Found tab when active */
nav a#tab-found.active-tab {
    background: var(--yellow); color: #333; border-color: var(--yellow);
    box-shadow: 0 4px 10px rgba(255, 214, 0, 0.4);
}

/* layout */
.container {
  max-width: 1100px; /* Made wider to fit screen nicely */
  width: 95%; /* Ensures it doesn't touch edges on mobile */
  margin: 10px auto 40px; /* Reduced top margin significantly */
  padding: 0 20px;
  animation: fadeIn 0.3s ease;
  flex: 1; 
  
  /* CRITICAL: This forces the footer off-screen initially */
  min-height: 85vh; 
}

.welcome-box {
  text-align: center; padding: 50px 30px;
  background: var(--card-bg); border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.05); margin-bottom: 40px;
  border: 1px solid var(--border);
  position: relative; overflow: hidden;
}
.welcome-box::before {
    content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 6px;
    background: linear-gradient(90deg, var(--indigo) 0%, var(--yellow) 100%);
}

/* search */
.search-container {
  max-width: 1100px; /* Match container width */
  width: 95%;
  margin: 20px auto 0; /* Reduced margin from navbar */
  padding: 0 20px;
  display: none;
}
.search-box { position: relative; width: 100%; }
.search-box input {
  width: 100%; 
  /* Increased left padding so text doesn't hit the icon */
  padding: 14px 14px 14px 55px; 
  border-radius: 50px; 
  border: 2px solid var(--border);
  background: var(--card-bg); 
  color: var(--text-main);
  font-family: 'Kanit'; 
  font-size: 16px;
  transition: 0.3s; 
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.search-box input:focus { border-color: var(--indigo); outline: none; }
.search-icon {
  position: absolute; 
  left: 20px; /* Moved slightly more right */
  top: 40%; 
  transform: translateY(-50%); 
  color: var(--indigo);
  font-size: 24px; /* Ensure icon size is fixed */
  pointer-events: none; /* Allows clicking through the icon */
}

/* items */
.item-list { display: grid; gap: 25px; }
.item {
  background: var(--card-bg); border-radius: 16px; padding: 25px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.05); border: 1px solid var(--border);
  position: relative; transition: transform 0.2s;
}
.item:hover { transform: translateY(-2px); }

.item-badge {
    display: inline-block; padding: 4px 10px; border-radius: 6px;
    font-size: 12px; font-weight: 600; margin-bottom: 10px;
}
.item.lost-item .item-badge { background: #e8eaf6; color: var(--indigo); }
.item.found-item .item-badge { background: #fffde7; color: #fbc02d; }
body.dark-mode .item.lost-item .item-badge { background: #303f9f; color: white; }
body.dark-mode .item.found-item .item-badge { background: #fbc02d; color: black; }

/* Contact Pills */
.contact-tag {
    display: inline-flex; align-items: center;
    background: var(--yellow-light); 
    color: var(--text-main);
    padding: 4px 10px; border-radius: 20px; 
    font-size: 13px; margin-right: 8px; border: 1px solid var(--border);
}

/* Closed Status */
.item.status-closed {
  opacity: 0.6; filter: grayscale(1);
}
.item.status-closed::after {
  content: "CLOSED"; position: absolute; top: 20px; right: 20px;
  border: 2px solid #666; color: #666; font-weight: bold;
  padding: 5px 10px; border-radius: 4px; transform: rotate(-10deg);
}

.item h3 { margin: 0 0 10px 0; font-size: 20px; color: var(--text-main); }
.item p { margin: 6px 0; color: var(--text-sec); font-size: 15px; }
.item-meta { display:flex; justify-content: space-between; margin-top: 20px; font-size: 13px; color: #999; border-top: 1px solid var(--border); padding-top: 15px;}

.item-actions {
  margin-top: 15px; display: flex; gap: 10px; justify-content: flex-end;
}
.btn-sm {
  padding: 6px 14px; border-radius: 6px; font-size: 13px; cursor: pointer; border:none;
  display: flex; align-items: center; gap: 6px; color: white; font-weight: 500;
}
.btn-close { background: var(--success); }
.btn-admin { background: var(--danger); }

/* modals & forms */
.modal-overlay {
  display: none; position: fixed; top: 0; left: 0;
  width: 100%; height: 100%; background: rgba(0,0,0,0.6);
  backdrop-filter: blur(5px); z-index: 1000; overflow-y: auto; padding: 20px;
}
.modal-content {
  background: var(--card-bg); margin: 60px auto; padding: 35px;
  border-radius: 20px; max-width: 480px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3); position: relative;
  border: 1px solid var(--border);
}

/* Contact List in Profile Modal */
.contact-row {
    display:flex; justify-content:space-between; align-items: center;
    background: var(--light-bg); 
    padding: 12px 15px; margin-bottom: 8px; border-radius: 8px;
    border: 1px solid var(--border);
}
.contact-row span { color: var(--text-main); } /* Fix for dark mode text */

input, select, textarea {
  width: 100%; padding: 12px 15px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 16px; font-family: 'Kanit';
  margin-bottom: 15px; background: var(--card-bg); color: var(--text-main);
  transition: 0.2s;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--indigo); outline: none; box-shadow: 0 0 0 3px rgba(63, 81, 181, 0.1);
}
label { display: block; margin-bottom: 8px; font-weight: 500; color: var(--text-main); font-size: 14px;}

/* buttons */
.btn-main { background: var(--indigo); color: white; width: 100%; padding: 12px; border:none; border-radius: 8px; font-size: 16px; cursor: pointer; font-weight: 500; transition:0.2s; }
.btn-main:hover { background: var(--indigo-dark); box-shadow: 0 4px 12px rgba(63, 81, 181, 0.3); }

.btn-sec { background: var(--light-bg); color: var(--text-main); width: 100%; padding: 12px; border:1px solid var(--border); border-radius: 8px; font-size: 16px; cursor: pointer; transition:0.2s; }
.btn-sec:hover { background: #e0e0e0; }

.btn-smart { background: #00695c; color: white; width: 100%; padding: 12px; border:none; border-radius: 8px; font-size: 16px; cursor: pointer; margin-bottom: 10px; display:flex; justify-content:center; align-items:center; gap:10px; font-weight: 500; }
.btn-smart:hover { background: #004d40; }

/* fab */
#fab {
  position: fixed; bottom: 40px; right: 40px;
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--indigo); color: white; border: none;
  font-size: 32px; cursor: pointer; box-shadow: 0 8px 24px rgba(63, 81, 181, 0.4);
  z-index: 900; display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s;
}
#fab:hover { transform: scale(1.1) rotate(90deg); }

#fabOptions {
  display: none; position: fixed; bottom: 110px; right: 40px;
  background: var(--card-bg); border-radius: 16px;
  box-shadow: 0 5px 25px rgba(0,0,0,0.15); width: 200px; z-index: 900;
  border: 1px solid var(--border); overflow: hidden;
}
.fab-option { padding: 16px 20px; cursor: pointer; color: var(--text-main); display: flex; align-items: center; gap: 15px; font-weight: 500; }
.fab-option:hover { background: var(--light-bg); }

.report-modal-width {
    max-width: 500px; /* Slightly wider for the form */
}
/* Image Upload Styling */
.image-upload-container {
    display: flex;
    justify-content: center;
    margin-bottom: 25px;
}
.image-upload-box {
    width: 250px;
    height: 150px;
    border: 2px dashed var(--border);
    border-radius: 20px; /* Rounded box */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: var(--light-bg);
    overflow: hidden;
    position: relative;
    transition: all 0.3s ease;
}
.image-upload-box:hover {
    border-color: var(--indigo);
    background: rgba(26, 35, 126, 0.05);
}
.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    pointer-events: none;
}
.image-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
/* Form Layout */
.form-row {
    display: flex;
    gap: 15px;
}
.form-group {
    flex: 1;
}
/* Fix Input spacing */
input[type="date"], input[type="time"] {
    font-family: 'Kanit', sans-serif;
}

/* Footer */
.site-footer {
    background: var(--indigo); color: white;
    padding: 40px 20px 20px; margin-top: auto;
}
.footer-content {
    max-width: 1100px; /* Match container width */
    margin: 0 auto;
    display: grid; grid-template-columns: 1fr 1fr; gap: 40px;
}
@media (max-width: 768px) { .footer-content { grid-template-columns: 1fr; } }

.footer-brand .footer-logo { font-size: 20px; font-weight: 600; margin-bottom: 15px; display:flex; align-items:center; gap:10px;}
.batch-number { background: var(--yellow); color: #333; padding: 2px 8px; border-radius: 4px; font-size: 14px; font-weight: bold; }
.mwit-link { color: rgba(255,255,255,0.7); text-decoration: none; display: inline-flex; align-items: center; gap: 5px; margin-top: 10px; transition: 0.2s;}
.mwit-link:hover { color: var(--yellow); }

.footer-dev-team h4 { margin: 0 0 15px 0; color: var(--yellow); }
.dev-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; font-size: 14px; color: rgba(255,255,255,0.8); }
.dev-name span { color: var(--yellow); font-weight: bold; margin-right: 5px; }

.footer-copyright {
    text-align: center; margin-top: 40px; padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1); font-size: 13px; color: rgba(255,255,255,0.5);
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }