@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #0d9488;
    --primary-hover: #0f766e;
    --bg-color: #f1f5f9;
    --card-bg: #ffffff;
    --text-main: #334155;
    --text-muted: #64748b;
    --sidebar-bg: #0f172a;
    --sidebar-text: #slate-300;
    --border-color: #e2e8f0;
    --danger: #ef4444;
    --warning: #f59e0b;
    --success: #10b981;
}

body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow: hidden;
}

/* Dashboard Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    height: 70px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    justify-content: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-header h2 {
    color: #fff;
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.sidebar-header i {
    color: var(--primary-color);
    margin-right: 10px;
    font-size: 24px;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav li {
    margin-bottom: 5px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.sidebar-nav a i {
    margin-right: 15px;
    font-size: 16px;
    width: 20px;
    text-align: center;
    color: #64748b;
    transition: all 0.3s ease;
}

.sidebar-nav a:hover, .sidebar-nav a.active {
    background-color: rgba(255,255,255,0.05);
    color: #fff;
    border-right: 3px solid var(--primary-color);
}

.sidebar-nav a:hover i, .sidebar-nav a.active i {
    color: var(--primary-color);
}

.sidebar-footer {
    padding: 15px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-footer a {
    color: #ef4444;
    text-decoration: none;
    font-size: 14px;
    display: flex;
    align-items: center;
    font-weight: 500;
}

.sidebar-footer a i {
    margin-right: 10px;
}

/* Main Content Wrapper */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Topbar */
.topbar {
    height: 70px;
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    flex-shrink: 0;
}

.page-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 14px;
    font-weight: 500;
}

.avatar {
    width: 36px;
    height: 36px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Content Body */
.content-body {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

/* Reusable UI Components */

/* Cards */
.card {
    background-color: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid rgba(0,0,0,0.02);
}

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

.card-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 16px;
    position: relative;
}

label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: #f8fafc;
    transition: all 0.2s ease;
    box-sizing: border-box;
    font-family: inherit;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}

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

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

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(13, 148, 136, 0.2);
}

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

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

.btn-light {
    background-color: white;
    color: var(--text-main);
    border: 1px solid var(--border-color);
}
.btn-light:hover {
    background-color: #f1f5f9;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border-color);
    background-color: #f8fafc;
}

td {
    padding: 14px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: rgba(241, 245, 249, 0.5);
}

.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-low-stock {
    background-color: #fef2f2;
    color: #ef4444;
}

.badge-warning {
    background-color: #fffbeb;
    color: #d97706;
}

.badge-success {
    background-color: #ecfdf5;
    color: #059669;
}

/* KPI Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0,0,0,0.02);
    cursor: pointer;
    transition: transform 0.2s;
}
.kpi-card:hover {
    transform: translateY(-3px);
}

.kpi-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-right: 20px;
}

.kpi-red .kpi-icon { background: #fef2f2; color: #ef4444; }
.kpi-orange .kpi-icon { background: #fffbeb; color: #d97706; }
.kpi-blue .kpi-icon { background: #eff6ff; color: #3b82f6; }
.kpi-green .kpi-icon { background: #ecfdf5; color: #10b981; }

.kpi-info h3 {
    margin: 0;
    font-size: 24px;
    color: #1e293b;
    font-weight: 700;
}

.kpi-info p {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Autocomplete Dropdown */
.autocomplete-items {
  position: absolute;
  border: 1px solid var(--border-color);
  border-top: none;
  z-index: 99;
  top: 100%;
  left: 0;
  right: 0;
  background-color: #fff;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  max-height: 200px;
  overflow-y: auto;
}

.autocomplete-items div {
  padding: 12px 14px;
  cursor: pointer;
  background-color: #fff;
  font-size: 14px;
  border-bottom: 1px solid #f1f5f9;
}
.autocomplete-items div:last-child {
  border-bottom: none;
}
.autocomplete-items div:hover {
  background-color: #f8fafc;
  color: var(--primary-color);
}
.autocomplete-active {
  background-color: #f1f5f9 !important; 
  color: var(--primary-hover); 
}

/* Print Styles */
@media print {
    body { background-color: #fff; margin: 0; }
    .sidebar, .topbar { display: none !important; }
    .main-content { overflow: visible !important; }
    .content-body { padding: 0 !important; }
    .card { box-shadow: none !important; border: none !important; }
    .no-print { display: none !important; }
    
    /* Order Layout Print */
    .print-header { 
        text-align: center; 
        border-bottom: 2px solid #000; 
        padding-bottom: 20px; 
        margin-bottom: 30px; 
    }
    .print-header h1 { font-size: 24px; margin: 0; }
    .print-header p { margin: 5px 0 0; color: #555; }
    
    table { width: 100%; border-collapse: collapse; }
    th { background: #eee; -webkit-print-color-adjust: exact; color: #000; }
    th, td { border: 1px solid #ccc; padding: 10px; text-align: left; }
}

/* Standard Login Base */
.login-page {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f0f4f8 0%, #e0e7ff 100%);
}
.login-box {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 400px;
    text-align: center;
}
.login-logo {
    font-size: 48px;
    color: var(--primary-color);
    margin-bottom: 20px;
}
.login-box h2 {
    margin-top: 0;
    margin-bottom: 30px;
    color: #1e293b;
}

/* Alert Boxes */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
}
.alert-success { background-color: #ecfdf5; color: #065f46; border: 1px solid #10b981; }
.alert-danger { background-color: #fef2f2; color: #991b1b; border: 1px solid #ef4444; }
.alert-info { background-color: #eff6ff; color: #1e40af; border: 1px solid #3b82f6; }
