﻿@import url('https://fonts.googleapis.com/css?family=Poppins');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Poppins", serif;
}

body {
    min-height: 100vh;
    background: linear-gradient(to left, black, grey);
}

/* -------------------- */
/* LOGIN PAGE STYLES */
/* -------------------- */

.container {
    width: 90%;
    max-width: 28rem;
    margin: 6vh auto;
}

.form-box {
    width: 100%;
    padding: 2rem;
    background: rgb(32, 21, 17);
    border-radius: 0.6rem;
    box-shadow: 0 0 0.8rem rgba(0, 0, 0, 0.35);
    display: none;
}

.form-box.active {
    display: block;
}

h2 {
    font-size: 1.8rem;
    text-align: center;
    margin-bottom: 1rem;
    color: salmon;
}

input,
select {
    width: 100%;
    padding: 0.8rem;
    margin-bottom: 1rem;
    border: none;
    border-radius: 0.4rem;
    outline: none;
    background: #eeeeee;
    color: #333333;
    font-size: 1rem;
}

button {
    width: 100%;
    padding: 0.8rem;
    margin-bottom: 1rem;
    border: none;
    border-radius: 0.4rem;
    background: lightsalmon;
    color: black;
    font-size: 1rem;
    cursor: pointer;
}

button:hover {
    background: saddlebrown;
    color: white;
}

.error-message {
    margin-bottom: 1rem;
    padding: 0.8rem;
    border-radius: 0.4rem;
    background: lightpink;
    color: red;
    text-align: center;
}

/* -------------------- */
/* ADMIN PAGE STYLES */
/* -------------------- */

.admin-page {
    background: #111827;
    color: #e5e7eb;
}

.admin-wrapper {
    width: 94%;
    max-width: 70rem;
    margin: 3vh auto;
    padding: 2rem;
    background: #1f2937;
    border-radius: 0.6rem;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.admin-title {
    font-size: 1.6rem;
    color: white;
    margin-bottom: 0.3rem;
}

.admin-subtitle {
    color: #cbd5e1;
    font-size: 0.95rem;
}

.logout-button {
    width: auto;
    margin-bottom: 0;
    background: #ef4444;
    color: white;
    padding: 0.7rem 1rem;
}

.logout-button:hover {
    background: #b91c1c;
}

.message {
    padding: 0.8rem;
    border-radius: 0.4rem;
    margin-bottom: 1rem;
}

.message.success {
    background: #14532d;
    color: #dcfce7;
}

.message.error {
    background: #7f1d1d;
    color: #fee2e2;
}

.admin-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

.page-link {
    display: inline-block;
    text-decoration: none;
    background: #374151;
    color: white;
    padding: 0.7rem 1rem;
    border-radius: 0.4rem;
}

.page-link:hover {
    background: #4b5563;
}

/* FILTER AREA */
.filter-box {
    margin-bottom: 2rem;
    padding: 1rem;
    background: #111827;
    border-radius: 0.6rem;
}

.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: flex-end;
}

.filter-label {
    display: block;
    width: 100%;
    color: #e5e7eb;
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
}

.filter-select {
    width: 100%;
    max-width: 18rem;
    margin-bottom: 0;
    flex: 0 0 18rem;
}

.filter-button,
.clear-filter-button {
    width: auto;
    min-width: 6.5rem;
    padding: 0.55rem 0.9rem;
    margin-bottom: 0;
    font-size: 0.9rem;
    line-height: 1.2;
}

.filter-button {
    background: #2563eb;
    color: white;
}

.filter-button:hover {
    background: #1d4ed8;
}

.clear-filter-button {
    background: #374151;
    color: white;
}

.clear-filter-button:hover {
    background: #4b5563;
}

.stock-table-wrapper {
    width: 100%;
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

.stock-table input[type=text], .stock-table input[type=number] {
    width: 100%;
    max-width: 100%;
    margin-bottom: 0;
    padding: 0.4rem;
    font-size: 0.85rem;
    color: black;
}

.stock-table .small-btn {
    width: auto;
    margin-bottom: 0;
    padding: 0.45rem 0.7rem;
    font-size: 0.85rem;
}

.stock-table {
    width: 100%;
    border-collapse: collapse;
    background: #111827;
    table-layout: fixed;
}

.stock-table th,
.stock-table td {
    padding: 0.8rem;
    text-align: left;
    border-bottom: 1px solid #374151;
    vertical-align: middle;
    overflow-wrap: break-word;
}

/* Give the actions column enough room */
.stock-table th:last-child,
.stock-table td:last-child {
    width: 18%;
    min-width: 8rem;
}

.stock-table th {
    background: #0f172a;
    color: #f8fafc;
}

.stock-table td {
    color: #e5e7eb;
}

.action-cell {
    white-space: nowrap;
}

.table-link {
    display: inline-block;
    margin-right: 0.35rem;
    color: #93c5fd;
    text-decoration: none;
}

.table-link:hover {
    text-decoration: underline;
}

.current-admin-text {
    color: #cbd5e1;
    font-size: 0.9rem;
}

.inline-form {
    display: inline;
    margin-left: 0.35rem;
}

.small-btn {
    width: auto;
    margin-bottom: 0;
    padding: 0.45rem 0.7rem;
    font-size: 0.9rem;
}

.delete-btn {
    background: #dc2626;
    color: white;
}

.delete-btn:hover {
    background: #991b1b;
}

.admin-card {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: #111827;
    border-radius: 0.6rem;
}

.admin-card h2 {
    text-align: left;
    font-size: 1.4rem;
    margin-bottom: 1rem;
    color: salmon;
}

.admin-card label {
    display: block;
    margin-bottom: 0.4rem;
    color: #e5e7eb;
    font-size: 0.95rem;
}

.primary-submit {
    background: #2563eb;
    color: white;
}

.primary-submit:hover {
    background: #1d4ed8;
}

/* MOBILE RESPONSIVE*/

@media (max-width: 576px) {

  .container {
    width: 92%;
  }

  .form-box {
    padding: 1.4rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  .admin-wrapper {
    width: 96%;
    padding: 1rem;
    overflow-x: hidden;
  }

  .admin-header {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-title {
    font-size: 1.3rem;
  }

  .admin-subtitle {
    font-size: 0.9rem;
  }

  .logout-button {
    width: 100%;
    text-align: center;
  }

  .admin-links {
    flex-direction: column;
  }

  .page-link {
    width: 100%;
    text-align: center;
  }

  .filter-form {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-label {
    margin-bottom: 0.35rem;
  }

  .filter-select {
    max-width: 100%;
    flex: 1 1 auto;
  }

  .filter-button,
  .clear-filter-button {
    width: 100%;
    min-width: 0;
    text-align: center;
  }

  .admin-card {
    padding: 1rem;
  }

  th, td {
  padding: 8px;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

  .stock-table-wrapper{
    width: 100%;
    overflow-x: hidden;
  }

  .stock-table {
    table-layout: fixed;
    width: 100%;
    min-width: 0;
    border-collapse: collapse;
  }

  .stock-table th,
  .stock-table td {
    padding: 0.45rem;
    font-size: 0.8rem;
    overflow-wrap: break-word;
    word-wrap: break-word;
    white-space: normal;
  }

  .stock-table th:last-child,
  .stock-table td:last-child {
    width: auto;
    min-width: 9rem;
  }

  .action-cell {
    white-space: normal;
  }

  .table-link {
    display: block;
    margin-right: 0;
    margin-bottom: 0.35rem;
    text-align: center;
  }

  .inline-form {
    display: block;
    margin-left: 0;
  }

  .small-btn,
  .stock-table .small-btn,
  .delete-btn {
    width: 100%;
    margin-right: 0;
    margin-bottom: 0;
    text-align: center;
  }
}
