/* assets/css/style.css */
/* Soft, Aesthetic, Rounded UI (Apple/Glass-like) */
:root {
    --primary-red: #ff4757;
    --primary-blue: #2ed573; /* A soft, energetic accent color - or stick to blue #1e90ff */
    --primary-yellow: #ffa502;
    --bg-light: #f7f9fc;
    --bg-white: #ffffff;
    --bg-dark: #2f3542;
    --text-dark: #2f3542;
    --text-light: #ffffff;
    --text-gray: #747d8c;
    --border-color: #f1f2f6;
    --border-width: 1px;
    --border-radius: 16px;
    --border-radius-sm: 8px;
    --box-shadow: 0 10px 25px rgba(0, 0, 0, 0.03);
    --box-shadow-hover: 0 15px 35px rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Poppins', 'Nunito', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

a {
    color: #1e90ff;
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 600;
}

a:hover {
    color: var(--primary-red);
}

/* Utility Layout Classes */
.card {
    background: var(--bg-white);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 2rem;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    border: none;
}

.flex-row { display: flex; flex-direction: row; }
.flex-col { display: flex; flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 1rem; }
.gap-2 { gap: 2rem; }
.gap-3 { gap: 3rem; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.w-100 { width: 100%; }

.text-center { text-align: center; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }

/* Admin & Customer Unified Layout */
.admin-layout { 
    display: flex; 
    min-height: 100vh; 
    background-color: var(--bg-light);
}

.admin-sidebar { 
    width: 260px; 
    background: var(--bg-white); 
    color: var(--text-dark); 
    padding: 2rem 0; 
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 20px rgba(0,0,0,0.02);
    z-index: 10;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.admin-sidebar h3 {
    color: var(--text-dark);
    margin-bottom: 2rem;
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0 1.5rem;
    font-weight: 800;
}

.sidebar-section-title {
    font-size:0.8rem; font-weight:700; color:var(--text-gray); text-transform:uppercase; margin-top:1.5rem; padding:0 1.5rem; margin-bottom: 0.5rem;
}

.admin-sidebar a {
    display: block;
    color: var(--text-gray);
    padding: 0.8rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    margin: 0.2rem 1rem;
    border-radius: var(--border-radius-sm);
    transition: all 0.3s ease;
}

.admin-sidebar a:hover, .admin-sidebar a.active {
    color: #1e90ff;
    background: #f1f8ff;
    font-weight: 600;
}

.admin-sidebar .sidebar-bottom {
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.admin-content { 
    flex: 1; 
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    padding: 2.5rem 3rem;
    background: var(--bg-light);
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.top-bar .page-title {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-dark);
}

.main-area {
    flex: 1;
}

/* Page Headers (Fallback) */
.page-header {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    font-weight: 800;
    color: var(--text-dark);
    padding-bottom: 0.5rem;
}

/* Forms */
.form-container { max-width: 600px; }
.form-group { margin-bottom: 1.5rem; flex: 1; }
.form-group label {
    display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.5rem;
    color: var(--text-dark);
}
.form-control {
    width: 100%; padding: 0.85rem 1.2rem; font-size: 0.95rem;
    border: 1px solid var(--border-color); background: var(--bg-white);
    font-family: 'Poppins', sans-serif; transition: all 0.3s ease;
    color: var(--text-dark);
    border-radius: var(--border-radius-sm);
}
.form-control:focus {
    outline: none; border-color: #1e90ff;
    box-shadow: 0 0 0 4px rgba(30, 144, 255, 0.1);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0.8rem 1.5rem; background: var(--bg-white); color: var(--text-dark);
    font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
    border: none; cursor: pointer; transition: all 0.3s ease;
    font-size: 0.85rem; text-decoration: none;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}
.btn:hover { 
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}
.btn-primary { background: var(--primary-red); color: var(--bg-white); }
.btn-primary:hover { background: #ff2a3f; }
.btn-blue { background: #1e90ff; color: var(--bg-white); }
.btn-blue:hover { background: #0984e3; }
.btn-secondary { background: var(--bg-white); color: var(--text-dark); border: 1px solid var(--border-color); box-shadow: none; }
.btn-secondary:hover { border-color: #1e90ff; color: #1e90ff; background: #fff; }

.active-view {
    background: #1e90ff !important;
    color: var(--text-light) !important;
    border-color: #1e90ff !important;
}

/* Tables */
.table-wrapper { 
    overflow-x: auto; 
    margin-bottom: 2rem; 
    border-radius: var(--border-radius); 
    background: var(--bg-white);
    box-shadow: var(--box-shadow);
    padding: 1rem;
}
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 1.2rem 1rem; border-bottom: 1px solid var(--border-color); text-align: left; font-size: 0.95rem; }
.table th { font-size: 0.8rem; color: var(--text-gray); text-transform: uppercase; font-weight: 700; border-bottom: 2px solid var(--border-color); }
.table tr:last-child td { border-bottom: none; }

/* Alerts */
.alert { padding: 1rem 1.5rem; font-size: 0.95rem; font-weight: 500; margin-bottom: 1.5rem; border-radius: var(--border-radius-sm); background: var(--bg-white); border-left: 4px solid var(--primary-blue); box-shadow: var(--box-shadow); }
.alert-success { border-left-color: #2ed573; background: #f1fcf5; }
.alert-danger { border-left-color: var(--primary-red); background: #fff1f2; }

/* Products Grid */
.products-wrapper { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 2rem; }
.product-card.card { padding: 0; overflow: hidden; display: flex; flex-direction: column; background: var(--bg-white); margin-bottom: 0; border: none; box-shadow: var(--box-shadow); border-radius: var(--border-radius); transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); }
.product-card.card:hover { box-shadow: var(--box-shadow-hover); transform: translateY(-5px); }
.product-card.card .img-wrapper { width: 100%; aspect-ratio: 1; background:#fdfdfd; display:flex; align-items:center; justify-content:center; overflow:hidden; border-radius: var(--border-radius) var(--border-radius) 0 0; }
.product-card.card .img-wrapper img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; mix-blend-mode: multiply; }
.product-card.card:hover .img-wrapper img { transform: scale(1.08); }
.product-card.card .info { padding: 1.5rem; flex: 1; display: flex; flex-direction: column; gap: 0.5rem; }
.product-card.card .info .title { font-weight: 700; font-size: 1.1rem; line-height: 1.4; color: var(--text-dark); }
.product-card.card .info .code { color: var(--text-gray); font-size: 0.85rem; font-weight: 500; }
.product-card.card .info .stock { color: #2ed573; font-size: 0.85rem; font-weight: 600; }
.product-card.card .info .price { font-weight: 800; font-size: 1.4rem; margin-top: auto; color: #1e90ff; }

/* New Actions UI */
.product-card.card .actions { padding: 0 1.5rem 1.5rem; display: flex; flex-direction: column; gap: 1rem; background: var(--bg-white); }
.product-card.card .actions .qty-row { display: flex; background: #f7f9fc; border-radius: 50px; height: 44px; padding: 4px; }
.product-card.card .actions .btn-qty-minus, .product-card.card .actions .btn-qty-plus { width: 36px; height: 36px; border-radius: 50%; background: #ffffff; border: none; cursor: pointer; font-weight: 600; font-size: 1.2rem; color: var(--text-dark); transition: all 0.2s; box-shadow: 0 2px 5px rgba(0,0,0,0.05); display: flex; align-items: center; justify-content: center; }
.product-card.card .actions .btn-qty-minus:hover, .product-card.card .actions .btn-qty-plus:hover { background: #f1f2f6; transform: scale(1.05); }
.product-card.card .actions .qty-input { flex: 1; text-align: center; border: none; background: transparent; font-weight: 700; font-size: 1rem; padding: 0; outline: none; font-family: 'Poppins', sans-serif; color: var(--text-dark); }
.product-card.card .actions .btn-add { width: 100%; font-weight: 700; padding: 0.8rem; font-size: 0.9rem; letter-spacing: 0.05em; border-radius: 50px; box-shadow: 0 4px 15px rgba(255, 71, 87, 0.3); }

/* Box view */
.view-box .products-wrapper { grid-template-columns: 1fr; gap: 1.5rem; }
.view-box .product-card.card { flex-direction: row; align-items: stretch; height: 180px; }
.view-box .product-card.card .img-wrapper { width: 180px; height: 100%; border-radius: var(--border-radius) 0 0 var(--border-radius); aspect-ratio: auto; }
.view-box .product-card.card .info { flex-direction: row; align-items: center; justify-content: space-between; flex:1; padding: 2rem; }
.view-box .product-card.card .info > div { display: flex; flex-direction: column; gap: 0.5rem; }
.view-box .product-card.card .actions { padding: 2rem; display: flex; flex-direction: column; justify-content: center; min-width: 220px; }

/* Checkboxes */
input[type="checkbox"] { width: 18px; height: 18px; border: 2px solid var(--border-color); border-radius: 4px; cursor: pointer; accent-color: #1e90ff; }

/* Custom Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-light); }
::-webkit-scrollbar-thumb { background: #ced6e0; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #a4b0be; }

/* Auth Layout for Login/Register */
.auth-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-light);
    padding: 2rem;
}
.auth-box {
    width: 100%;
    max-width: 450px;
    background: var(--bg-white);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 3rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.auth-brand {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary-red);
    margin-bottom: 2rem;
    text-transform: uppercase;
    letter-spacing: -0.02em;
}
.auth-box form { width: 100%; }
.auth-box .form-group { width: 100%; }

/* Mobile */
@media (max-width: 992px) {
    .admin-layout { flex-direction: column; }
    
    .mobile-top-bar { display: flex !important; }
    .desktop-only { display: none !important; }
    .mobile-quick-links { display: block !important; }
    .desktop-only-links { display: none !important; }

    .admin-sidebar { 
        position: fixed; 
        top: 0; 
        left: -300px; 
        height: 100vh; 
        width: 280px; 
        padding: 1rem 0; 
        box-shadow: 2px 0 20px rgba(0,0,0,0.1); 
        transition: left 0.3s ease; 
        z-index: 100;
        overflow-y: auto;
    }
    
    .admin-sidebar.mobile-open {
        left: 0;
    }

    .top-bar { padding: 0 0 1.5rem 0; flex-direction: column; gap: 1rem; align-items: flex-start; }
    .admin-content { padding: 1.5rem; }
}
@media (max-width: 768px) {
    .products-wrapper { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1.5rem; }
    .view-box .product-card.card { flex-direction: column; height: auto; }
    .view-box .product-card.card .img-wrapper { width: 100%; height: 200px; border-radius: var(--border-radius) var(--border-radius) 0 0; }
    .view-box .product-card.card .info { flex-direction: column; align-items: flex-start; padding: 1.5rem; }
    .view-box .product-card.card .actions { width: 100%; padding: 0 1.5rem 1.5rem; }
    .page-header { font-size: 1.5rem; }
}

/* Hide number input spin buttons for inline edit */
input[type=number].inline-edit::-webkit-inner-spin-button,
input[type=number].inline-edit::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number].inline-edit {
  -moz-appearance: textfield;
}

/* Toggle Switch Styles */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.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: .3s;
}
.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
input:checked + .slider {
  background-color: var(--primary-green, #2ed573);
}
input:checked + .slider:before {
  transform: translateX(20px);
}
.slider.round {
  border-radius: 24px;
}
.slider.round:before {
  border-radius: 50%;
}
