/* style.css */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Myanmar:wght@400;500;600;700&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); min-height: 100vh; }

/* Login Screen */
.login-container { display: flex; justify-content: center; align-items: center; min-height: 100vh; padding: 20px; }
.login-form { background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(10px); padding: 40px; border-radius: 20px; box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1); width: 100%; max-width: 400px; animation: slideUp 0.6s ease-out; }
@keyframes slideUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
.login-title { text-align: center; color: #333; margin-bottom: 30px; font-size: 28px; font-weight: 600; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; color: #555; font-weight: 500; }
.form-group input { width: 100%; padding: 12px 16px; border: 2px solid #e1e5e9; border-radius: 10px; font-size: 16px; transition: all 0.3s ease; }
.form-group input:focus { outline: none; border-color: #667eea; box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1); }
.login-btn { width: 100%; padding: 14px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; border: none; border-radius: 10px; font-size: 16px; font-weight: 600; cursor: pointer; transition: all 0.3s ease; }
.login-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3); }

/* Dashboard */
.dashboard { display: none; min-height: 100vh; background: #f8fafc; }
.navbar { background: white; padding: 1rem 2rem; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); display: flex; justify-content: space-between; align-items: center; }
.navbar h1 { color: #333; font-size: 24px; }
.logout-btn { background: #ef4444; color: white; border: none; padding: 8px 16px; border-radius: 8px; cursor: pointer; font-weight: 500; transition: all 0.3s ease; }
.logout-btn:hover { background: #dc2626; }
.main-content { padding: 2rem; max-width: 1400px; margin: 0 auto; }
.controls { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; flex-wrap: wrap; gap: 1rem; }
.right-buttons { display: flex; gap: 1rem; flex-wrap: wrap; } /* Added for button grouping */
.btn { padding: 10px 20px; border: none; border-radius: 8px; cursor: pointer; font-weight: 600; transition: all 0.3s ease; font-size: 14px; }
.btn-primary { background: #667eea; color: white; } .btn-primary:hover { background: #5a67d8; }
.btn-success { background: #10b981; color: white; } .btn-success:hover { background: #059669; }
.btn-warning { background: #f59e0b; color: white; } .btn-warning:hover { background: #d97706; }
.btn-danger { background: #ef4444; color: white; } .btn-danger:hover { background: #dc2626; }

/* Table Containers */
.table-container, .gold-prices-display-container .table-wrapper { background: white; border-radius: 12px; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1); overflow-x: auto; margin-bottom: 2rem; }
.gold-prices-display-container { margin-top: 2rem; }
.table { width: 100%; border-collapse: collapse; min-width: 900px; }
.table th, .table td { padding: 12px 8px; text-align: center; border-bottom: 1px solid #e5e7eb; border-left: 1px solid #e5e7eb; }
.table th:first-child, .table td:first-child { border-left: none; }
.table th { background: #f8fafc; font-weight: 600; color: #374151; padding: 8px 16px; }
.table tbody tr:hover { background: #f9fafb; }
.dashboard-table-header-group th { text-align: center; vertical-align: middle; background-color: #f8fafc; }
.dashboard-table-header-group .nested-header-cell { padding: 5px; font-size: 14px; font-weight: normal; border-top: 1px solid #e5e7eb; }
.gold-prices-display-table { width: 100%; border-collapse: collapse; }
.gold-prices-display-table th, .gold-prices-display-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid #e5e7eb; color: #374151; }
.gold-prices-display-table th { font-weight: 600; color: white; }
.gold-prices-display-table th:nth-child(2), .gold-prices-display-table td:nth-child(2) { text-align: center; }
.gold-prices-display-table th:nth-child(4), .gold-prices-display-table td:nth-child(4) { text-align: center; }
.gold-prices-display-table th:nth-child(3), .gold-prices-display-table td:nth-child(3) { text-align: right; font-weight: bold; }
.gold-prices-display-table tbody tr:hover { background: #f9fafb; }

/* Modal Styles */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(5px); z-index: 1000; }
.modal-content { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: white; padding: 2rem; border-radius: 12px; width: 90%; max-width: 800px; max-height: 95vh; overflow-y: auto; animation: modalSlide 0.3s ease-out; }
@keyframes modalSlide { from { opacity: 0; transform: translate(-50%, -60%); } to { opacity: 1; transform: translate(-50%, -50%); } }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.modal-title { font-size: 20px; font-weight: 600; color: #333; }
.close-btn { background: none; border: none; font-size: 24px; cursor: pointer; color: #6b7280; }
.close-btn:hover { color: #374151; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.form-row.full { grid-template-columns: 1fr; }
.form-row.three-col { grid-template-columns: 1fr 1fr 1fr; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: 500; color: #374151; }
.form-group input, .form-group select { width: 100%; padding: 10px 12px; border: 2px solid #e5e7eb; border-radius: 8px; font-size: 14px; }
.form-group input:focus, .form-group select:focus { outline: none; border-color: #667eea; }
.modal-actions { display: flex; gap: 1rem; justify-content: flex-end; margin-top: 2rem; }

/* Reduced Price field style */
input[name^="reducedPrice"] {
    background-color: #e9ecef;
    font-weight: bold;
    color: #495057;
}

/* History Modal */
.history-table-container { max-height: 60vh; overflow-y: auto; margin-top: 1rem; }
.history-table { width: 100%; border-collapse: collapse; }
.history-table th, .history-table td { padding: 10px 15px; border: 1px solid #e5e7eb; text-align: center; vertical-align: top; }
.history-table th { background-color: #f8fafc; font-weight: 600; color: #374151; position: sticky; top: 0; z-index: 10; }
.history-filter-controls { display: flex; gap: 1rem; align-items: center; margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid #e5e7eb; flex-wrap: wrap; }
.history-filter-controls .form-group { flex-grow: 1; margin-bottom: 0; }

/* --- Mobile List Styles --- */
.data-list { display: none; }
.data-card { background: white; border-radius: 12px; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08); padding: 1rem; border-left: 5px solid #667eea; margin-bottom: 1rem; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; padding-bottom: 0.75rem; border-bottom: 1px solid #e5e7eb; }
.card-date { font-size: 1.1rem; font-weight: 600; color: #374151; }
.card-idg .data-label { color: #374151; font-weight: 500; font-size: 0.9rem; margin-right: 0.25rem; }
.card-idg .data-value { font-size: 1.1rem; font-weight: 600; color: #10b981; }
.card-section { margin-bottom: 1rem; } .card-section:last-child { margin-bottom: 0; }
.card-section-title { font-weight: 600; color: #667eea; margin-bottom: 0.75rem; padding-bottom: 0.5rem; border-bottom: 1px dashed #e5e7eb; }
.data-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1rem; }
.data-group { display: flex; flex-direction: column; }
.data-label { font-size: 0.8rem; color: #6b7280; margin-bottom: 0.25rem; text-transform: uppercase; }
.data-value { font-size: 1rem; font-weight: 500; color: #374151; }
.history-list .gold-price-details { font-size: 0.9rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #e5e7eb; }
.history-list .gold-price-item { display: flex; justify-content: space-between; padding: 0.25rem 0; }
.gold-price-card { background: white; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.07); padding: 0.75rem 1rem; margin-bottom: 0.75rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }
.gold-price-card .material-info { flex-grow: 1; }
.gold-price-card .material-name { font-weight: 600; color: #374151; font-size: 1rem; }
.gold-price-card .material-quality { font-size: 0.85rem; color: #6b7280; }
.gold-price-card .buy-price { font-size: 1.1rem; font-weight: 700; color: #17a2b8; text-align: right; }
.gold-price-card .last-updated { font-size: 0.8rem; color: #6b7280; width: 100%; text-align: right; margin-top: 0.25rem; border-top: 1px dashed #e5e7eb; padding-top: 0.5rem; }
.gold-price-input-card { background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 8px; padding: 1rem; margin-bottom: 1rem; }
.gold-price-input-card .form-row { grid-template-columns: 1fr 1fr; }
.gold-price-input-card .form-group { margin-bottom: 0.5rem; }
.gold-price-input-card label { font-size: 0.9rem; }
.gold-price-input-card input { font-size: 14px; padding: 8px 10px; }
.gold-price-input-card .remove-gold-price-row-btn { width: 100%; margin-top: 0.5rem; }
.gold-price-list-wrapper { max-height: 60px; overflow: hidden; transition: max-height 0.3s ease-in-out; }
.gold-price-list-wrapper.expanded { max-height: 500px; }
.gold-price-list-item { margin-bottom: 5px; padding-bottom: 5px; border-bottom: 1px dotted #ccc; font-size: 0.9em; }
.gold-price-list-item:last-child { border-bottom: none; }
.toggle-gold-prices { background: none; border: 1px solid #667eea; color: #667eea; padding: 3px 8px; border-radius: 5px; font-size: 0.8em; cursor: pointer; margin-top: 8px; }
.toggle-gold-prices:hover { background: #f0f4f8; }

/* Apply Noto Sans Myanmar to elements with myanmar-text class */
.myanmar-text {
  font-family: "Noto Sans Myanmar", sans-serif;
}

/* --- Responsive Media Queries --- */
@media (max-width: 768px) {
  .table-container, .history-table-container, .gold-prices-display-table, .gold-price-modal-table { display: none; }
  #dataList, #historyList, #goldPricesDisplayList, #goldPriceInputsList { display: block; }
  .controls { flex-direction: column; align-items: stretch; }
  .right-buttons { flex-direction: column; align-items: stretch; } /* Adjusted for mobile */
  .form-row, .form-row.three-col { grid-template-columns: 1fr; }
  .modal-content { width: 95%; padding: 1.5rem; max-height: 98vh; }
  .modal-title { font-size: 18px; }
  .navbar { padding: 1rem; }
  .navbar h1 { font-size: 20px; }
  .main-content { padding: 1rem; }
  .history-filter-controls { flex-direction: column; align-items: stretch; gap: 0.75rem; }
  .history-filter-controls .form-group { flex-grow: 0; }
}

@media (min-width: 769px) { .data-list { display: none; } }
@media (max-width: 480px) {
  .main-content { padding: 0.5rem; }
  .login-form { padding: 20px; }
  .login-title { font-size: 24px; }
  .form-group input { padding: 10px 12px; font-size: 14px; }
  .login-btn { padding: 12px; font-size: 14px; }
  .btn { padding: 8px 15px; font-size: 13px; }
  .data-grid { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  .data-card { padding: 0.75rem; }
}
