/* Bearing Traders Inventory System - Mobile-First Responsive Styles */

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

:root {
    --color-teal-500: rgba(33, 128, 141, 1);
    --color-red-500: rgba(192, 21, 47, 1);
    --color-orange-500: rgba(168, 75, 47, 1);
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --bg-light: #f9fafb;
    --border-color: #e5e7eb;
    --white: #ffffff;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --color-success-rgb: 33, 128, 141;
    --color-error-rgb: 192, 21, 47;
    --color-warning-rgb: 168, 75, 47;
    --color-error: var(--color-red-500);
    --color-success: var(--color-teal-500);
    --color-warning: var(--color-orange-500);
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-light);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

.login-box {
    background: var(--white);
    padding: 40px 30px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}

.logo-section {
    text-align: center;
    margin-bottom: 30px;
}

.logo-section h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.logo-section p {
    font-size: 14px;
    color: var(--text-light);
}

.login-box h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 25px;
    text-align: center;
    color: var(--text-dark);
}

.form-group {
    margin-bottom: 20px;
}

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    font-family: inherit;
}

input[type="date"] {
    padding: 10px 12px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 10px;
    border-radius: 4px;
    font-size: 13px;
    border-left: 4px solid #f5c6cb;
}

.success-message {
    color: #2ed573;
    background: #e6f7ed;
    padding: 10px;
    border-radius: 4px;
    font-size: 13px;
    border-left: 4px solid #2ed573;
}

.message-container {
  position: fixed;
  top: 35px;
  right: 20px;
  z-index: 2000;
  max-width: 330px;
}

.message {
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 8px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.04);
  font-weight: 500;
  border: 1px solid;
  animation: slideIn 0.3s ease;
}

.message-success {
  background: rgba(var(--color-success-rgb, 40, 167, 69), 0.1);
  color: var(--color-success);
  border-color: rgba(var(--color-success-rgb, 40, 167, 69), 0.2);
  text-align: right;
}

.message-error {
  background: rgba(var(--color-error-rgb, 220, 53, 69), 0.1);
  color: var(--color-error);
  border-color: rgba(var(--color-error-rgb, 220, 53, 69), 0.2);
  text-align: right;
}

.message-warning {
  background: rgba(var(--color-warning-rgb, 255, 193, 7), 0.1);
  color: var(--color-warning);
  border-color: rgba(var(--color-warning-rgb, 255, 193, 7), 0.2);
  text-align: right;
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    min-height: 48px;
    touch-action: manipulation;
    -webkit-appearance: none;
    appearance: none;
}

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

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    background-color: #9ca3af;
    opacity: 0.6;
    cursor: not-allowed;
}

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

.btn-secondary:hover {
    background-color: #059669;
}

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

.btn-danger:hover {
    background-color: #dc2626;
}

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

/* Edit button styling */
.btn-edit {
    background-color: var(--warning-color);
    color: var(--white);
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.btn-edit:hover {
    background-color: #d97706;
}

/*.btn-edit:hover {*/
/*    background-color: var(--primary-dark);*/
/*    transform: translateY(-2px);*/
/*    box-shadow: var(--shadow-lg);*/
/*}*/

/*.btn-edit:active {*/
/*    transform: translateY(0);*/
/*}*/

/*.btn-edit:disabled {*/
/*    background-color: #9ca3af;*/
/*    opacity: 0.6;*/
/*    cursor: not-allowed;*/
/*}*/

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

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

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

.btn-sm {
    padding: 8px 12px;
    font-size: 14px;
    min-height: 40px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.alternative-login {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-light);
}

.alternative-login a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

/* Dashboard Styles */
.dashboard-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    background-color: var(--white);
    box-shadow: var(--shadow);
    padding: 16px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
}

.header-user {
    display: flex;
    align-items: center;
    gap: 15px;
}

.username {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 14px;
    display: none;
}

.logout-btn {
    padding: 10px 16px;
    font-size: 14px;
    background-color: var(--danger-color);
    color: var(--white);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    min-height: 44px;
}

.logout-btn:hover {
    background-color: #dc2626;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: 12px 0;
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.nav-item {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0px 12px;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 60px;
    border-radius: 8px;
}

.nav-item.active {
    color: var(--primary-color);
    background-color: rgba(37, 99, 235, 0.1);
}

.nav-icon {
    font-size: 20px;
    margin-bottom: 4px;
}

.nav-label {
    font-size: 12px;
    font-weight: 600;
}

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

.stat-card {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: var(--white);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-card h3 {
    font-size: 14px;
    margin-bottom: 10px;
    opacity: 0.9;
}

.stat-number {
    font-size: 28px;
    font-weight: 700;
    margin: 0;
}

/* Quick Actions */
.quick-actions {
    background-color: var(--bg-light);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.quick-actions h3 {
    margin-bottom: 15px;
    color: var(--text-dark);
    font-size: 18px;
}

.action-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.main-content {
    flex: 1;
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    padding-bottom: 100px; /* Extra padding for bottom nav */
}

/* Sections */
.section {
    display: none;
    background-color: var(--white);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 80px; /* Space for bottom nav */
}

.section.active {
    display: block;
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-dark);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 12px;
}

.tabs {
    display: none;
}

.tab-content {
    display: none;
}

/* Scanner Styles */
/*.scanner-container {*/
/*    margin: 20px 0;*/
/*    border-radius: 8px;*/
/*    overflow: hidden;*/
/*}*/

.scanner-container {
    margin: 20px 0;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--primary-color);
    background: #000;
    transition: all 0.3s ease;
}

.scanner-container:not(.hidden) {
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.3);
}

#scannerContainerSale {
    margin-bottom: 30px;
}

#reader, #readerSale {
    max-width: 100%;
    border-radius: 8px;
    overflow: hidden;
    background-color: #000;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scan-result {
    margin-top: 20px;
    padding: 16px;
    background-color: var(--bg-light);
    border-radius: 8px;
    border-left: 4px solid var(--secondary-color);
}

/* Table Styles */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead {
    background-color: var(--bg-light);
}

th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-dark);
    white-space: nowrap;
    border-bottom: 2px solid var(--border-color);
}

td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

tr:hover {
    background-color: var(--bg-light);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    overflow-y: auto;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background-color: var(--white);
    padding: 30px;
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-dark);
}

.close-modal {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-light);
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
    width: 32px;
    height: 32px;
    line-height: 1;
    min-height: auto;
}

.close-modal:hover {
    color: var(--text-dark);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.filters {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.search-box {
    position: relative;
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--white);
    border: 2px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 10;
    display: none;
    box-shadow: var(--shadow);
}

.search-suggestions.active {
    display: block;
}

.suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.suggestion-item:hover {
    background-color: var(--bg-light);
}

.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-pending {
    background-color: #fef3c7;
    color: #92400e;
}

.status-completed {
    background-color: #d1fae5;
    color: #065f46;
}

.status-ready {
    background-color: #d1fae5;
    color: #065f46;
}

/* Loading Spinner */
.spinner {
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-content {
    background-color: var(--white);
    padding: 30px;
    border-radius: 12px;
    text-align: center;
}

/* Sale Items */
.sale-item {
    background-color: var(--bg-light);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sale-item-info {
    flex: 1;
}

.sale-item-remove {
    background-color: var(--danger-color);
    color: var(--white);
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.sale-item-remove:hover {
    background-color: #dc2626;
}

/* Cart table styles */
#cartSection {
    margin-top: 20px;
}

#cartTableBody tr:hover {
    background-color: #f8f9fa;
}

/* Cart item highlight animation */
@keyframes highlight-pulse {
    0% { background-color: #fff3cd; }
    50% { background-color: #ffeaa7; }
    100% { background-color: #fff3cd; }
}

.cart-item-highlight {
    animation: highlight-pulse 1s ease-in-out 3;
}

/* Make cart section more prominent */
#cartSection {
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    padding: 20px;
    background-color: var(--bg-light);
    margin-top: 20px;
}

#cartSection:not(.hidden) {
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

/* Modal improvements */
.modal-content {
    max-width: 600px;
}

/* Button spacing */
.btn-sm {
    margin: 2px;
}

/* Staff Dashboard Specific */
.staff-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
}

.scan-section {
    text-align: center;
}

.big-scan-btn {
    padding: 30px 50px;
    font-size: 24px;
    background-color: var(--secondary-color);
    color: var(--white);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    min-height: 70px;
    margin: 20px 0;
    transition: all 0.3s ease;
}

.big-scan-btn:hover {
    background-color: #059669;
    transform: scale(1.05);
}

.big-scan-btn:disabled {
    background-color: #9ca3af;
    cursor: not-allowed;
    transform: scale(1);
}

.status-indicator {
    font-size: 18px;
    font-weight: 600;
    margin: 20px 0;
    padding: 15px;
    border-radius: 8px;
    background-color: var(--bg-light);
}

/* Read-only input styling */
input[readonly] {
    background-color: #f9fafb;
    cursor: not-allowed;
}

/* Responsive Design */
@media (min-width: 640px) {
    .username {
        display: block;
    }
    
    .form-row {
        grid-template-columns: 1fr 1fr;
    }
    
    .filters {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .login-box {
        padding: 50px 40px;
    }
    
    .filters {
        grid-template-columns: repeat(3, 1fr);
    }
    
    table {
        font-size: 15px;
    }
    
    .modal-content {
        padding: 40px;
    }
    
    .action-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .nav-label {
        font-size: 13px;
    }
}

@media (min-width: 1024px) {
    .filters {
        grid-template-columns: repeat(4, 1fr);
    }
    .bottom-nav {
        padding: 15px 0;
    }
    
    .nav-item {
        padding: 0px 16px;
    }
    
}

/* Print Styles */
@media print {
    .header, .filters, .logout-btn {
        display: none;
    }
}

/* Utility Classes */
.text-center { text-align: center; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.hidden { display: none !important; }
.flex { display: flex; }
.gap-10 { gap: 10px; }
.justify-between { justify-content: space-between; }
.items-center { align-items: center; }