/* resources/css/app.css */

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

:root {
    /* Color Palette — Bright Warm Theme */
    --primary: #f97316;         /* Orange 500 */
    --primary-hover: #ea580c;   /* Orange 600 */
    --primary-light: #fff7ed;   /* Orange 50 */
    --primary-mid: #fed7aa;     /* Orange 200 */

    --secondary: #fbbf24;       /* Amber 400 */
    --secondary-hover: #f59e0b; /* Amber 500 */

    --success: #16a34a;
    --success-light: #dcfce7;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --info: #0284c7;
    --info-light: #e0f2fe;

    /* Backgrounds */
    --bg-base: #fff8f1;          /* Warm off-white */
    --bg-surface: #ffffff;
    --bg-sidebar: #ffffff;       /* Clean white sidebar */
    --bg-sidebar-hover: #fff4eb; /* Soft orange tint on hover */

    /* Text */
    --text-primary: #1c1917;    /* Warm near-black */
    --text-secondary: #78716c;  /* Warm gray */
    --text-inverse: #ffffff;
    --text-sidebar: #44403c;    /* Sidebar nav text */

    /* Borders & Shadows */
    --border: #e7e5e4;
    --border-sidebar: #f5f0eb;
    --shadow-sm: 0 1px 3px 0 rgba(249, 115, 22, 0.08);
    --shadow: 0 4px 12px -1px rgba(249, 115, 22, 0.12), 0 2px 6px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 25px -3px rgba(249, 115, 22, 0.15), 0 4px 8px -2px rgba(0, 0, 0, 0.06);
    --shadow-glass: 0 8px 32px 0 rgba(249, 115, 22, 0.08);

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-lg: 1rem;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: var(--primary);
    transition: var(--transition);
}

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

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

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    color: var(--text-sidebar);
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 16px rgba(249, 115, 22, 0.08);
    border-right: 1px solid var(--border-sidebar);
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: 1.75rem 1.5rem;
    font-size: 1.4rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border-sidebar);
    color: var(--text-primary);
}

.sidebar-header .icon {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 2rem;
}

.sidebar-nav {
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

.nav-item {
    padding: 0.875rem 1rem;
    border-radius: var(--radius);
    color: var(--text-sidebar);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: var(--transition);
}

.nav-item:hover {
    background-color: var(--bg-sidebar-hover);
    color: var(--primary);
    transform: translateX(4px);
}

.nav-item.active {
    background: linear-gradient(90deg, #fff4eb 0%, #fffaf5 100%);
    color: var(--primary);
    border-left: 3px solid var(--primary);
    font-weight: 600;
}

/* Main Content */
.main-content {
    flex-grow: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
}

/* Topbar */
.topbar {
    height: 70px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-sidebar);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.06);
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Content Area */
.content-area {
    padding: 2rem;
    flex-grow: 1;
}

/* Glassmorphism Card */
.glass-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: var(--shadow-glass);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

.glass-card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
}

/* Typography Utilities */
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.text-primary { color: var(--primary); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    outline: none;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #fb923c);
    color: white;
    box-shadow: 0 4px 12px -1px rgba(249, 115, 22, 0.45);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover), var(--primary));
    box-shadow: 0 6px 16px -1px rgba(249, 115, 22, 0.55);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: white;
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background-color: var(--bg-base);
    border-color: var(--text-secondary);
}

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

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

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background-color: white;
    color: var(--text-primary);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

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

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table th {
    background-color: var(--bg-base);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table td {
    padding: 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background-color: var(--bg-base);
}

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

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background-color: var(--success-light);
    color: var(--success);
}

.badge-danger {
    background-color: var(--danger-light);
    color: var(--danger);
}

.badge-warning {
    background-color: var(--warning-light);
    color: var(--warning);
}

.badge-info {
    background-color: var(--info-light);
    color: var(--info);
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    animation: slideInDown 0.4s ease-out;
}

.alert-success {
    background-color: var(--success-light);
    color: #065f46;
    border-left: 4px solid var(--success);
}

.alert-error {
    background-color: var(--danger-light);
    color: #991b1b;
    border-left: 4px solid var(--danger);
}

/* Utilities */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }

/* Animations */
@keyframes slideInDown {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.animate-fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* Dashboard POS specific */
.pos-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

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

.product-card {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: var(--primary-light);
}

.product-img {
    height: 140px;
    width: 100%;
    object-fit: cover;
    background-color: var(--bg-base);
}

.product-info {
    padding: 1rem;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px dashed var(--border);
}

/* ============================================================
   DASHBOARD & LAPORAN — Metric Cards
   ============================================================ */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.metric-card {
    background: #ffffff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding: 1.4rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.1rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.metric-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.metric-revenue::before  { background: linear-gradient(90deg, #f97316, #fbbf24); }
.metric-monthly::before  { background: linear-gradient(90deg, #0284c7, #38bdf8); }
.metric-product::before  { background: linear-gradient(90deg, #16a34a, #4ade80); }
.metric-alert::before    { background: linear-gradient(90deg, #dc2626, #f87171); }

.metric-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    flex-shrink: 0;
}

.metric-revenue .metric-icon  { background: #fff7ed; color: #f97316; }
.metric-monthly .metric-icon  { background: #e0f2fe; color: #0284c7; }
.metric-product .metric-icon  { background: #dcfce7; color: #16a34a; }
.metric-alert   .metric-icon  { background: #fee2e2; color: #dc2626; }

.metric-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.metric-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.metric-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.metric-sub {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-top: 0.1rem;
}

/* ============================================================
   DASHBOARD GRID (2-column layout)
   ============================================================ */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* ============================================================
   BAR CHART
   ============================================================ */
.chart-container {
    width: 100%;
    overflow-x: auto;
}

.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 0.6rem;
    height: 200px;
    padding: 0 0.5rem 0.5rem;
    min-width: 100%;
}

.chart-bar-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    flex: 1;
    min-width: 36px;
    height: 100%;
    justify-content: flex-end;
}

.chart-bar-wrapper {
    width: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    flex: 1;
}

.chart-bar {
    width: 100%;
    max-width: 48px;
    min-height: 4px;
    background: linear-gradient(180deg, #f97316 0%, #fbbf24 100%);
    border-radius: 6px 6px 0 0;
    position: relative;
    transition: opacity 0.2s;
    cursor: pointer;
}

.chart-bar:hover {
    opacity: 0.85;
}

.chart-bar:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #1c1917;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 10;
}

.chart-bar-value {
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-secondary);
    white-space: nowrap;
}

.chart-bar-label {
    font-size: 0.68rem;
    color: var(--text-secondary);
    text-align: center;
    white-space: nowrap;
    font-weight: 500;
}

/* ============================================================
   TOP PRODUCT ITEM (Dashboard)
   ============================================================ */
.top-product-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.top-product-item:last-child {
    border-bottom: none;
}

.top-product-item:hover {
    background: var(--bg-base);
    margin: 0 -0.5rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    border-radius: var(--radius-sm);
}

.top-product-rank {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-base);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid var(--border);
}

.top-product-rank.rank-top {
    background: linear-gradient(135deg, #f97316, #fbbf24);
    color: white;
    border-color: transparent;
}

.top-product-info {
    flex: 1;
    min-width: 0;
}

/* ============================================================
   STOCK ALERT ITEM
   ============================================================ */
.stock-alert-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.stock-alert-item:last-child {
    border-bottom: none;
}

/* ============================================================
   EXTRA UTILITIES
   ============================================================ */
.py-4  { padding-top: 1rem; padding-bottom: 1rem; }
.py-6  { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.mt-2  { margin-top: 0.5rem; }
.mb-0  { margin-bottom: 0; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.table th.text-right { text-align: right; }
.table td.text-right { text-align: right; }
.table th.text-center { text-align: center; }
.table td.text-center { text-align: center; }

/* Responsive */
@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    .sidebar {
        display: none;
    }
    .main-content {
        margin-left: 0;
    }
}
