/* Mobile-First Responsive Styles */
:root {
  --primary-color: #1e3a5f;
  --secondary-color: #2d5a87;
  --accent-color: #3498db;
  --success-color: #27ae60;
  --danger-color: #e74c3c;
  --light-bg: #f8f9fa;
  --text-dark: #333;
  --text-muted: #666;
  --border-color: #ddd;
  --sidebar-width: 260px;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--light-bg);
  margin: 0;
  padding: 0;
  color: var(--text-dark);
  min-height: 100vh;
}

/* Mobile Navigation Toggle */
.mobile-nav-toggle {
  display: none;
  position: fixed;
  top: 15px;
  left: 15px;
  z-index: 1001;
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 12px 15px;
  border-radius: 8px;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.mobile-nav-toggle:hover {
  background: var(--secondary-color);
}

/* Sidebar - Desktop */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: linear-gradient(180deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
  padding-top: 60px;
  z-index: 1000;
  overflow-y: auto;
  transition: transform 0.3s ease;
}

.sidebar .brand {
  padding: 15px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar .brand img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
}

.sidebar .brand h4 {
  margin: 0;
  font-size: 18px;
}

.sidebar nav {
  padding: 10px 0;
}

.sidebar nav a {
  display: block;
  padding: 12px 20px;
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.sidebar nav a:hover,
.sidebar nav a.active {
  background: rgba(255,255,255,0.1);
  color: white;
  border-left-color: var(--accent-color);
}

.sidebar nav a i {
  margin-right: 10px;
  width: 20px;
}

/* Main Content */
.main-content {
  margin-left: var(--sidebar-width);
  padding: 20px;
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}

/* Page Header */
.page-header {
  background: white;
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 20px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.page-header h1 {
  margin: 0 0 5px;
  font-size: 24px;
  color: var(--primary-color);
}

.page-header p {
  margin: 0;
  color: var(--text-muted);
}

/* Cards */
.card {
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  margin-bottom: 20px;
  overflow: hidden;
}

.card-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.card-header h3 {
  margin: 0;
  font-size: 18px;
  color: var(--primary-color);
}

.card-body {
  padding: 20px;
}

/* Buttons */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background: var(--secondary-color);
}

.btn-danger {
  background: var(--danger-color);
  color: white;
}

/* Tables */
.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  background: var(--light-bg);
  font-weight: 600;
  color: var(--primary-color);
  white-space: nowrap;
}

.data-table tr:hover {
  background: #f8f9fa;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.stat-card {
  background: white;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  text-align: center;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: bold;
  color: var(--primary-color);
}

.stat-card .stat-label {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 5px;
}

/* Forms */
.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  color: var(--text-dark);
}

.form-control {
  width: 100%;
  padding: 10px 15px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 14px;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-color);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.show {
  display: flex;
}

.modal-dialog {
  background: white;
  border-radius: 10px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 15px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* Login Page */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

.login-card {
  background: white;
  border-radius: 15px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.login-card .logo {
  width: 80px;
  display: block;
  margin: 0 auto 20px;
}

.login-card h1 {
  text-align: center;
  color: var(--primary-color);
  margin-bottom: 30px;
}

/* Alerts */
.alert {
  padding: 15px 20px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.alert-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.alert-danger {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.alert-info {
  background: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

/* Badge */
.badge {
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.badge-success {
  background: #d4edda;
  color: #155724;
}

.badge-danger {
  background: #f8d7da;
  color: #721c24;
}

/* ==================== MOBILE RESPONSIVE STYLES ==================== */

/* Tablets and below */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }
  
  .sidebar.show {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .mobile-nav-toggle {
    display: block;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile phones */
@media (max-width: 768px) {
  .page-header {
    padding: 15px;
  }
  
  .page-header h1 {
    font-size: 20px;
  }
  
  .card-header {
    padding: 12px 15px;
    flex-direction: column;
    align-items: flex-start;
  }
  
  .card-header h3 {
    font-size: 16px;
  }
  
  .card-body {
    padding: 15px;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .stat-card {
    padding: 15px;
  }
  
  .stat-card .stat-value {
    font-size: 24px;
  }
  
  .data-table {
    font-size: 13px;
  }
  
  .data-table th,
  .data-table td {
    padding: 8px 10px;
  }
  
  .btn {
    padding: 8px 12px;
    font-size: 13px;
  }
  
  .btn i {
    margin-right: 5px;
  }
  
  .modal-dialog {
    margin: 10px;
    max-height: calc(100vh - 20px);
  }
  
  .login-card {
    padding: 30px 20px;
  }
  
  .form-row {
    flex-direction: column;
  }
  
  .form-group {
    min-width: 100%;
  }
}

/* Small mobile phones */
@media (max-width: 480px) {
  .page-header h1 {
    font-size: 18px;
  }
  
  .page-header p {
    font-size: 13px;
  }
  
  .stat-card .stat-label {
    font-size: 12px;
  }
  
  .card-header h3 {
    font-size: 14px;
  }
  
  .btn {
    width: 100%;
    justify-content: center;
    margin-bottom: 5px;
  }
  
  .badge {
    font-size: 10px;
    padding: 3px 8px;
  }
  
  .table-responsive {
    font-size: 12px;
  }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
  .btn,
  .sidebar nav a,
  .form-control {
    min-height: 44px;
  }
  
  .sidebar nav a {
    padding: 15px 20px;
  }
  
  .data-table th,
  .data-table td {
    padding: 12px 8px;
  }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
  .sidebar {
    padding-top: 50px;
  }
  
  .sidebar nav a {
    padding: 10px 20px;
  }
  
  .login-container {
    min-height: auto;
    padding: 20px;
  }
}

/* Utility classes for mobile */
.hide-mobile {
  display: block;
}

.show-mobile {
  display: none;
}

@media (max-width: 768px) {
  .hide-mobile {
    display: none;
  }
  
  .show-mobile {
    display: block;
  }
  
  .d-flex-mobile {
    display: flex;
  }
  
  .flex-column-mobile {
    flex-direction: column;
  }
}

/* Print styles */
@media print {
  .sidebar,
  .mobile-nav-toggle,
  .btn,
  .no-print {
    display: none !important;
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}

/* Smooth scrolling for mobile */
html {
  scroll-behavior: smooth;
}

/* Prevent horizontal scroll */
body {
  overflow-x: hidden;
}

/* Logo Styles */
.logo {
  max-width: 200px;
  height: auto;
  display: block;
  margin: 0 auto 1rem;
  border-radius: 50%;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  border: 3px solid #fff;
  background: #fff;
  padding: 10px;
}

/* Container */
.container {
  background: white;
  padding: 2rem;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
  width: 100%;
  max-width: 800px;
  margin: 2rem;
}

/* Headings */
h1 {
  text-align: center;
  color: #4a5568;
  margin-bottom: 1.5rem;
  font-weight: 600;
}

h2 {
  color: #2d3748;
  margin-bottom: 1rem;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 0.5rem;
}

h3 {
  color: #2d3748;
  margin-bottom: 1rem;
}

/* Form section */
.form-section {
  margin-bottom: 2rem;
}

.product-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-card {
  background: #f8f9fa;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  margin-bottom: 1rem;
}

.form-card h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  color: #2d3748;
  font-size: 1.2rem;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 0.5rem;
}

.form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.form-group {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
}

.form-group label {
  margin-bottom: 0.5rem;
  font-weight: 500;
}

/* Icon styles */
.icon-product::before { content: "📦 "; }
.icon-type::before { content: "🏷️ "; }
.icon-price::before { content: "💰 "; }
.icon-quantity::before { content: "🔢 "; }
.icon-unit::before { content: "⚖️ "; }
.icon-size::before { content: "📏 "; }
.icon-serial::before { content: "🔢 "; }
.icon-barcode::before { content: "📊 "; }

/* Input styles */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 10px 15px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.3s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-color);
}

/* Button styles */
button[type="submit"],
.btn-submit {
  background: var(--primary-color);
  color: white;
  padding: 12px 30px;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.3s;
  margin-top: 1rem;
}

button[type="submit"]:hover,
.btn-submit:hover {
  background: var(--secondary-color);
}

/* Product grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

@media (max-width: 768px) {
  .product-grid {
    grid-template-columns: 1fr;
  }
}

.product-card {
  background: white;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  transition: transform 0.3s;
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.product-card h4 {
  margin: 0 0 10px;
  color: var(--primary-color);
}

.product-card .price {
  font-size: 18px;
  font-weight: bold;
  color: var(--success-color);
}

.product-card .quantity {
  color: var(--text-muted);
  font-size: 14px;
}
