/* style.css */

/* --- General Body & Typography --- */
body {
    font-family: 'Inter', sans-serif;
    background-color: #f8f9fa;
    color: #333;
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- Navigation Bar --- */
.navbar {
    background-color: #ffffff;
    padding: 1rem 0;
    border-bottom: 1px solid #e9ecef;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: #343a40;
    text-decoration: none;
}

.nav-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
}

.nav-links li {
    margin-left: 20px;
}

.nav-links a {
    text-decoration: none;
    color: #495057;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-links a:hover,
.nav-links a.active {
    color: #007bff;
}

/* --- Main Content Area --- */
main.container {
    padding-top: 100px; 
    padding-bottom: 40px;
}

/* --- THIS IS THE LAYOUT FIX --- */
/* On the main page, stack the form and barcode sections */
main.container:has.form-container {
    display: flex;
    flex-direction: column; /* Changed from row to column */
    gap: 40px;
    align-items: center; /* Center the items horizontally */
}


/* --- Form & Barcode Containers --- */
.form-container, .barcode-display-container {
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    width: 100%;
    max-width: 800px; /* Give them a max width for larger screens */
    box-sizing: border-box;
}

.barcode-display-container { text-align: center; }
.barcode-display { margin-top: 20px; }

h2 { margin-top: 0; font-size: 1.8rem; color: #212529; }
.subtitle { color: #6c757d; margin-bottom: 30px; }

/* --- Form Elements --- */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; }
.form-group input[type="text"], .form-group input[type="date"], .form-group input[type="file"] {
    width: 100%; padding: 12px; border: 1px solid #ced4da; border-radius: 6px; box-sizing: border-box;
}
.form-group input:focus { outline: none; border-color: #80bdff; box-shadow: 0 0 0 0.2rem rgba(0,123,255,0.25); }
.form-row { display: flex; gap: 20px; }
.form-row .form-group { flex: 1; }
hr { border: none; border-top: 1px solid #e9ecef; margin: 30px 0; }

/* --- Quill Rich Text Editor --- */
#editor-container { height: 250px; }
.ql-toolbar.ql-snow { border-top-left-radius: 6px; border-top-right-radius: 6px; border-color: #ced4da; }
.ql-container.ql-snow { border-bottom-left-radius: 6px; border-bottom-right-radius: 6px; border-color: #ced4da; }

/* --- Buttons --- */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 20px; border: none; border-radius: 6px; font-size: 1rem; font-weight: 600;
    cursor: pointer; text-decoration: none; transition: background-color 0.3s ease;
}
.btn-primary { background-color: #007bff; color: #fff; }
.btn-primary:hover { background-color: #0056b3; }
.btn-secondary { background-color: #6c757d; color: #fff; }
.btn-secondary:hover { background-color: #5a6268; }

/* --- Toggle Switch --- */
.form-group-toggle { display: flex; align-items: center; justify-content: space-between; }
.switch { position: relative; display: inline-block; width: 60px; height: 34px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; }
.slider:before { position: absolute; content: ""; height: 26px; width: 26px; left: 4px; bottom: 4px; background-color: white; transition: .4s; }
input:checked + .slider { background-color: #28a745; }
input:checked + .slider:before { transform: translateX(26px); }
.slider.round { border-radius: 34px; }
.slider.round:before { border-radius: 50%; }

/* --- Messages & Status --- */
.message { padding: 15px; margin-top: 20px; border-radius: 6px; }
.message-success { background-color: #d4edda; color: #155724; }
.message-error { background-color: #f8d7da; color: #721c24; }

/* --- Login Page --- */
.login-container { display: flex; justify-content: center; align-items: center; height: 100vh; }
.login-box { background: #fff; padding: 40px; border-radius: 8px; box-shadow: 0 5px 15px rgba(0,0,0,0.1); width: 100%; max-width: 400px; text-align: center; }

/* --- Admin Page --- */
.admin-header { text-align: center; margin-bottom: 30px; }
.admin-controls { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 20px; padding: 20px; background-color: #fff; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
#search-barcode { flex-grow: 1; padding: 10px; border-radius: 6px; border: 1px solid #ced4da; }
#report-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); gap: 20px; }

/* --- Report Card --- */
.report-card { background: #fff; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.08); display: flex; flex-direction: column; }
.card-header { display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; background-color: #f8f9fa; }
.card-header h3 { margin: 0; font-size: 1.2rem; }
.card-body { padding: 20px; flex-grow: 1; }
.card-body h4 { margin-top: 15px; margin-bottom: 5px; color: #007bff; }
.card-body p { margin: 0 0 10px; }
.card-body ul { margin: 0; padding-left: 20px; }
.date-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.report-text-content { border-top: 1px solid #e9ecef; padding-top: 15px; margin-top: 15px; max-height: 200px; overflow-y: auto; }
.card-barcode { padding: 20px; text-align: center; background-color: #f8f9fa; }
.status-returned { background-color: #ffc107; color: #333; padding: 5px 10px; border-radius: 12px; font-size: 0.8rem; }
.status-ok { background-color: #28a745; color: #fff; padding: 5px 10px; border-radius: 12px; font-size: 0.8rem; }

/* --- Scanner Modal Styles --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}
.modal-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    max-width: 500px;
    width: 90%;
}
#qr-reader {
    width: 100%;
    border: 1px solid #e9ecef;
    margin-bottom: 20px;
    border-radius: 6px;
    overflow: hidden;
}
#qr-reader video {
    width: 100% !important;
    height: auto !important;
}

/* --- Responsive Design --- */
@media (max-width: 992px) {
    /* This is no longer needed as flex-direction is column by default now */
}
@media (max-width: 768px) {
    .navbar .container { flex-direction: column; align-items: flex-start; }
    .nav-links { margin-top: 10px; }
    .nav-links li { margin-left: 0; margin-right: 15px; }
    main.container { padding-top: 150px; }
    .admin-controls { flex-direction: column; gap: 15px; align-items: stretch; }
    #search-barcode { width: 100%; box-sizing: border-box; }
    .form-row { flex-direction: column; gap: 0; }
}

