/* styles.css - Main stylesheet */

:root {
    --primary-color: #4CAF50;
    --secondary-color: #2E7D32;
    --accent-color: #8BC34A;
    --text-color: #333;
    --light-bg: #f5f5f5;
    --light-border: #ddd;
    --error-color: #f44336;
    --success-color: #4CAF50;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Poppins', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--light-bg);
    padding: 20px;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--light-border);
}

h1, h2, h3 {
    color: var(--primary-color);
}

h1 {
    font-size: 1.8rem;
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 15px;
}

.btn {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.3s;
}

.btn:hover {
    background-color: var(--secondary-color);
}

.btn-secondary {
  background-color: #3c74b4;
}

.btn-secondary:hover {
    background-color: #616161;
}

.btn-danger {
    background-color: var(--error-color);
}

.btn-danger:hover {
    background-color: #d32f2f;
}

.tab-container {
    margin-bottom: 20px;
}

.tabs {
    display: flex;
    border-bottom: 1px solid var(--light-border);
}

.tab {
    padding: 10px 20px;
    cursor: pointer;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 5px 5px 0 0;
    margin-right: 5px;
    background-color: #f9f9f9;
}

.tab.active {
    background-color: white;
    border-color: var(--light-border);
    border-bottom: 1px solid white;
    margin-bottom: -1px;
    color: var(--primary-color);
    font-weight: 500;
}

.tab-content {
    display: none;
    padding: 20px;
    border: 1px solid var(--light-border);
    border-top: none;
    border-radius: 0 0 5px 5px;
    background-color: white;
}

.tab-content.active {
    display: block;
}

.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

input, select, textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--light-border);
    border-radius: 4px;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
}

input[type="range"] {
    padding: 0;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.range-value {
    display: inline-block;
    margin-left: 10px;
    font-weight: bold;
}

.table-container {
    overflow-x: auto;
    margin-bottom: 20px;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

th, td {
  padding: 3px 15px 3px 0px;
  text-align: left;
  border-bottom: 1px solid var(--light-border);
}

th {
    background-color: #f9f9f9;
    font-weight: 600;
    cursor: pointer;
    position: relative;
}

th:hover {
    background-color: #f1f1f1;
}

th::after {
    content: '↕';
    position: absolute;
    right: 5px;
    opacity: 0.3;
}

th.sort-asc::after {
    content: '↓';
    opacity: 1;
}

th.sort-desc::after {
    content: '↑';
    opacity: 1;
}

tr:hover {
    background-color: #f5f5f5;
}

.actions {
    display: flex;
    gap: 5px;
}

.action-btn {
  padding: 4px 8px;
  font-size: 10px;
  margin-top: 3px;
  font-weight: 600;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 100;
    overflow: auto;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    position: relative;
}

.close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
}

.alert {
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-weight: 500;
    display: none;
}

.alert-success {
    background-color: #e8f5e9;
    color: var(--success-color);
    border: 1px solid #c8e6c9;
}

.alert-error {
    background-color: #ffebee;
    color: var(--error-color);
    border: 1px solid #ffcdd2;
}

.login-container {
    max-width: 400px;
    margin: 50px auto;
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.initialization-notice {
    background-color: #fff8e1;
    border: 1px solid #ffd54f;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    text-align: center;
}

.loading {
    display: none;
    text-align: center;
    padding: 20px;
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border-left-color: var(--primary-color);
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}





.summary-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: white;
    padding: 10px 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    font-weight: 500;
}

.summary-item {
  display: flex;
  align-items: center;
  padding-right: 20px;
}

.summary-item span {
    font-weight: 700;
    color: var(--primary-color);
    margin-right: 5px;
    font-size: 1.1em;
}

@media (max-width: 600px) {
    .summary-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}




.summary-container {
  flex: 1;
  display: flex;
}
.summary-container .summary-card {
  padding-right: 33px;
}
.summary-title {
  display: inline-block;
}
.summary-value {
  display: inline-block;
}
/* Add these styles to styles.css */

/* Style for the Total column */
th[data-sort="total"] {
    font-weight: 700;
    background-color: #f0f8f0;
}

td[data-field="total"] {
    font-weight: 700;
    color: var(--primary-color);
    background-color: #f9fff9;
}

/* Ensure that the fields display in a readable manner on mobile */
@media (max-width: 768px) {
    th, td {
        padding: 8px 4px;
        font-size: 14px;
    }

    .table-container {
        overflow-x: auto;
        max-width: 100%;
    }
}



/* Add these styles to styles.css */

/* Filter row styles */
.filter-row th {
    padding: 8px 5px;
    background-color: #f0f8f0;
    border-bottom: 1px solid var(--light-border);
}

.filter-select {
  width: 83% !important;
  margin-left: -10px;
}
tr.filter-row th::after {
  content: '' !important;
}
.filter-select:focus {
    border-color: var(--primary-color);
    outline: none;
}

#resetFiltersBtn {
    margin-right: 10px;
    margin-bottom: 10px;
    background-color: #757575;
}

#resetFiltersBtn:hover {
    background-color: #616161;
}

/* Style for filtered rows */
#purchasesTable tbody tr.filtered-out {
    display: none;
}

/* Make table header sticky on long tables */
.table-container {
  max-height: 100%;
  overflow-y: auto;
  padding-bottom: 33px;
}
#purchasesTable thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

#purchasesTable thead tr th,
#purchasesTable thead tr.filter-row th {
  background-color: #f9f9f9;
  box-shadow: 0 1px 0 0 var(--light-border);
  padding-right: 19px;
}
/* Make the filter row sticky as well */
#purchasesTable thead tr.filter-row {
  position: sticky;
  top: 32px;
  z-index: 9;
}
/* Improve mobile responsiveness */
@media (max-width: 768px) {
    .filter-select {
        font-size: 11px;
        padding: 4px;
    }

    #resetFiltersBtn {
        display: block;
        width: 100%;
        margin-bottom: 10px;
    }
}




/* Add these styles to your styles.css file */

/* Center specific columns in the table */
#purchasesTable th[data-sort="weight_grams"],
#purchasesTable th:contains("Grams"),
#purchasesTable td[data-field="weight_grams"],
#purchasesTable td[data-field*="grams"] {
    text-align: center;
}

#purchasesTable th[data-sort="rating"],
#purchasesTable th:contains("Rating"),
#purchasesTable td[data-field="rating"],
#purchasesTable td[data-field*="rating"] {
    text-align: center;
}

#purchasesTable th[data-sort="cbd"],
#purchasesTable th:contains("CBD"),
#purchasesTable td[data-field="cbd"],
#purchasesTable td[data-field*="cbd"] {
    text-align: center;
}

#purchasesTable th[data-sort="thc_d9"],
#purchasesTable th:contains("THC-D9"),
#purchasesTable td[data-field="thc_d9"],
#purchasesTable td[data-field*="thc"] {
    text-align: center;
}

#purchasesTable th[data-sort="thca"],
#purchasesTable th:contains("THCA"),
#purchasesTable td[data-field="thca"],
#purchasesTable td[data-field*="thca"] {
    text-align: center;
}

#purchasesTable th[data-sort="terps"],
#purchasesTable th:contains("Terps"),
#purchasesTable td[data-field="terps"],
#purchasesTable td[data-field*="terp"] {
    text-align: center;
}

/* Since :contains is not standard CSS, adding a JavaScript solution to handle this */





#purchases button#resetFiltersBtn:not(:first-of-type) {
    display: none;
}

/* Total column styling */
th[data-sort="total"],
td[data-field="total"] {
    font-weight: bold;
    color: #2E7D32;
    text-align: right;
}

.summary-item:last-child {
    font-weight: bold;
    color: #2E7D32;
}
th {
  width: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
td:not(.actions) {
  max-width: 20px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

button:not(.action-btn) {
  box-shadow: 1px 1px 20px lightslategrey;
  margin-right: 11px;
}



/* Add to styles.css */
.column-toggles {
  display: inline-block;
  margin-left: 15px;
  vertical-align: middle;
  background-color: #f5f5f5;
  padding: 5px 10px;
  border-radius: 4px;
  border: 1px solid #ddd;
  width: calc( 18% - 0px );
  min-width: 358px;
}
.pagination-controls {
  display: inline-block !important;
  width: 25% !important;
}
.pagination-controls select#month-selector {
  padding: 8px;
  border-radius: 4px;
  border: 1px solid rgb(221, 221, 221);
  margin-right: 5px;
  flex-grow: 1;
  max-width: 250px;
}
select.identify_me {
  display: inline-block;
  width: auto;
  float: left;
  margin: -3px 18px 0;
}


.column-toggles label {
  display: inline-block;
  position: relative;
  top: -2px;
}
.column-toggles input, .column-toggles select, .column-toggles textarea {
  width: auto;
}
span.column-toggles-show-hide {
  position: relative;
  top: -1px;
  padding-right: 9px;
}




/**/
th[data-sort="cbd"], td[data-field="cbd"] {
  display: none;
}
th:nth-of-type(9) {display: none;}

th[data-sort="thc_d9"], td[data-field="thc_d9"] {
  display: none;
}
th:nth-of-type(10) {display: none;}

th[data-sort="Terpenes"], td[data-field="Terpenes"] {
  display: none;
}
th:nth-of-type(12) {display: none;}
