:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --bg-light: #f8fafc;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-light);
    color: var(--text-primary);
}

/* Login Screen */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    width: 120px;
    height: auto;
    margin-bottom: 1rem;
    object-fit: contain;
}

.login-header i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    display: none; /* Hide icon, use logo instead */
}

.login-header h1 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-secondary);
}

.form-group {
    margin-bottom: 1.5rem;
}

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

.form-group label i {
    margin-right: 0.5rem;
    color: var(--primary-color);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.error-message {
    color: var(--danger-color);
    margin-top: 1rem;
    text-align: center;
    display: none;
}

.error-message.show {
    display: block;
}

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

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 4px;
}

.sidebar-header i {
    font-size: 1.5rem;
    color: var(--primary-color);
    display: none; /* Hide icon, use logo instead */
}

.sidebar-header h2 {
    font-size: 1.25rem;
    margin: 0;
}

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.5rem;
    min-height: 44px; /* Touch-friendly */
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: white;
}

.nav-item.active {
    background: var(--sidebar-hover);
    color: white;
    border-left-color: var(--primary-color);
}

.nav-item i {
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info i {
    font-size: 2rem;
    color: var(--primary-color);
}

.user-name {
    font-weight: 600;
}

.user-role {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.7);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 2rem;
}

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

.top-header h1 {
    font-size: 2rem;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.notification-icon {
    position: relative;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.3s ease;
}

.notification-icon:hover {
    color: var(--primary-color);
}

.badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger-color);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 10;
}

.notification-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 380px;
    max-width: 90vw;
    max-height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.notification-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-light);
}

.notification-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-clear-all {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.btn-clear-all:hover {
    background: rgba(37, 99, 235, 0.1);
}

.notification-list {
    overflow-y: auto;
    max-height: 400px;
}

.notification-empty {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.notification-item {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 0.75rem;
    cursor: pointer;
    transition: background 0.2s ease;
    position: relative;
}

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

.notification-item.read {
    opacity: 0.7;
}

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

.notification-icon-small {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
}

.notification-icon-small.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.notification-icon-small.info {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

.notification-icon-small.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-item-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    font-size: 0.9375rem;
}

.notification-item-message {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.notification-item-time {
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
}

.notification-action {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8125rem;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: background 0.2s ease;
}

.notification-action:hover {
    background: var(--primary-dark);
}

.notification-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    opacity: 0;
    transition: all 0.2s ease;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-item:hover .notification-close {
    opacity: 1;
}

.notification-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--danger-color);
}

/* Views */
.view {
    display: none;
}

.view.active {
    display: block;
}

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

/* Categories Grid */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.category-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.category-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: var(--primary-color);
}

.category-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.category-info {
    flex: 1;
}

.category-info h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.category-info p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

.category-arrow {
    color: var(--text-secondary);
    font-size: 1rem;
    transition: transform 0.3s ease;
}

.category-actions {
    display: flex;
    gap: 0.5rem;
}

.category-actions .btn {
    padding: 0.35rem 0.6rem;
    font-size: 0.8rem;
}

.category-card:hover .category-arrow {
    transform: translateX(4px);
    color: var(--primary-color);
}

.stat-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.stat-icon.sales {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stat-icon.transactions {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.stat-icon.products {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.stat-icon.low-stock {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.stat-info h3 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Dashboard Charts */
.dashboard-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.dashboard-search-box {
    flex: 1;
    min-width: 240px;
    max-width: 460px;
}

.dashboard-controls .filter-select {
    min-width: 170px;
}

.dashboard-controls .btn {
    white-space: nowrap;
}

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

.chart-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.chart-card h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.recent-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.recent-item {
    padding: 0.75rem;
    background: var(--bg-light);
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.visual-chart {
    min-height: 260px;
}

.dashboard-line-chart-wrap {
    height: 240px;
    width: 100%;
}

.dashboard-line-chart {
    width: 100%;
    height: 100%;
}

.dashboard-line-grid {
    stroke: #e2e8f0;
    stroke-width: 1;
}

.dashboard-line-area {
    fill: rgba(37, 99, 235, 0.12);
}

.dashboard-line-stroke {
    fill: none;
    stroke: #2563eb;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.dashboard-line-point {
    fill: #2563eb;
    stroke: #ffffff;
    stroke-width: 2;
}

.dashboard-line-point.muted {
    opacity: 0.55;
}

.dashboard-line-y-label,
.dashboard-line-x-label {
    fill: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
}

.status-donut-layout {
    min-height: 240px;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.status-donut {
    position: relative;
    width: 170px;
    height: 170px;
    border-radius: 50%;
    flex: 0 0 auto;
}

.status-donut::after {
    content: '';
    position: absolute;
    inset: 28px;
    border-radius: 50%;
    background: var(--card-bg);
}

.status-donut-center {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
}

.status-donut-center strong {
    font-size: 1.5rem;
    line-height: 1;
}

.status-donut-center small {
    margin-top: 0.25rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.status-legend {
    flex: 1;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.status-legend-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.status-legend-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-dot {
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 50%;
    flex: 0 0 auto;
}

.status-legend-count {
    color: var(--text-secondary);
    font-weight: 600;
}

.visual-empty {
    min-height: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

@media (max-width: 900px) {
    .dashboard-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .dashboard-search-box,
    .dashboard-controls .filter-select,
    .dashboard-controls .btn {
        width: 100%;
        max-width: none;
    }

    .dashboard-charts {
        grid-template-columns: 1fr;
    }

    .dashboard-line-chart-wrap {
        height: 210px;
    }

    .status-donut-layout {
        justify-content: center;
    }
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s;
}

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

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

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

.btn-secondary:hover {
    background: #475569;
}

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

.btn-success:hover {
    background: #059669;
}

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

.btn-warning:hover {
    background: #d97706;
}

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

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

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

/* View Header */
.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.view-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.view-header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
}

.filter-select {
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: white;
}

/* Tables */
.table-container {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

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

.data-table thead {
    background: var(--bg-light);
}

.data-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.data-table tbody tr:hover {
    background: var(--bg-light);
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-badge.in-stock {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.low-stock {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.out-of-stock {
    background: #fee2e2;
    color: #991b1b;
}

.status-badge.unknown {
    background: #e5e7eb;
    color: #6b7280;
}

/* Sales Form */
.sales-container {
    max-width: 800px;
    margin: 0 auto;
}

.sales-form-card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.sales-items {
    margin-bottom: 1.5rem;
}

.sales-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    gap: 1rem;
    align-items: end;
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--bg-light);
    border-radius: 8px;
}

.sales-total {
    text-align: right;
    padding: 1.5rem 0;
    border-top: 2px solid var(--border-color);
    margin-top: 1.5rem;
}

.sales-total h3 {
    font-size: 1.5rem;
    color: var(--primary-color);
}

/* Reports */
.reports-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.report-filters-card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.report-filters-card h3 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-size: 1.25rem;
}

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

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.filter-group.filter-actions {
    display: flex;
    flex-direction: row;
    gap: 0.75rem;
    align-items: flex-end;
}

.filter-group.filter-actions .btn {
    flex: 1;
}

.report-results {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    min-height: 200px;
}

.report-summary {
    margin-bottom: 2rem;
}

.report-summary h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.report-details {
    margin-top: 2rem;
}

.report-details h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

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

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

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.modal-body {
    padding: 1.5rem;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1001;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 1.25rem;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: background 0.3s;
}

.mobile-menu-toggle:hover {
    background: var(--primary-dark);
}

.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

/* Responsive Design */
/* Mobile Phones (< 480px) */
@media (max-width: 480px) {
    .mobile-menu-toggle {
        display: flex;
    }

    .mobile-menu-overlay {
        display: block;
    }

    .sidebar {
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 1rem 0.75rem;
    }

    .top-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    .top-header h1 {
        font-size: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-card h3 {
        font-size: 0.875rem;
    }

    .stat-card .stat-value {
        font-size: 1.5rem;
    }

    .view-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .view-header-left,
    .view-header-right {
        width: 100%;
        flex-direction: column;
        gap: 0.75rem;
    }

    .search-box {
        max-width: 100%;
        min-width: 100%;
    }

    .filter-select {
        width: 100%;
        min-width: 100%;
    }

    .data-table {
        font-size: 0.875rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.5rem 0.25rem;
    }

    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .btn {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
        min-height: 44px; /* Touch-friendly */
    }

    .btn-large {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }

    .login-card {
        padding: 1.5rem;
        margin: 1rem;
    }

    .login-header h1 {
        font-size: 1.5rem;
    }

    .form-group {
        margin-bottom: 1rem;
    }

    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 0.875rem;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .report-filters-grid,
    .report-filters {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .filter-group.filter-actions {
        flex-direction: column;
    }

    .filter-group.filter-actions .btn {
        width: 100%;
    }

    .sales-form {
        padding: 1rem;
    }

    .sales-items {
        gap: 0.75rem;
    }

    .sales-item {
        padding: 0.75rem;
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .sales-item > * {
        width: 100%;
    }

    .sales-item .btn-danger {
        width: 100%;
        margin-top: 0.5rem;
    }

    .modal {
        width: 95%;
        max-width: 95%;
        margin: 1rem auto;
        padding: 1rem;
    }

    .modal-header h2 {
        font-size: 1.25rem;
    }

    #transactions-view .view-header-right {
        flex-direction: column;
        align-items: stretch;
    }

    #transactions-view .search-box {
        min-width: 100%;
    }

    #transactions-view .filter-select {
        min-width: 100%;
    }
}

/* Tablets (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }

    .mobile-menu-overlay {
        display: block;
    }

    .sidebar {
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .view-header {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .view-header-right {
        flex: 1;
        min-width: 100%;
    }

    .search-box {
        max-width: 100%;
    }

    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table {
        font-size: 0.9rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.75rem 0.5rem;
    }

    .report-filters-grid,
    .report-filters {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .btn {
        min-height: 44px; /* Touch-friendly */
    }

    .form-group input,
    .form-group textarea,
    .form-group select {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .sales-item {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .sales-item > * {
        width: 100%;
    }

    /* Improve touch targets for tablets */
    .nav-item {
        min-height: 48px;
    }

    .btn {
        min-height: 44px;
    }
}

/* Small Tablets (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }

    .main-content {
        margin-left: 220px;
        padding: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .view-header {
        flex-wrap: wrap;
    }

    .table-container {
        overflow-x: auto;
    }

    .report-filters-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Large Screens - Hide mobile menu */
@media (min-width: 1025px) {
    .mobile-menu-toggle {
        display: none;
    }

    .mobile-menu-overlay {
        display: none !important;
    }

    .sidebar {
        transform: translateX(0) !important;
    }
}

/* Additional Mobile Optimizations */
@media (max-width: 768px) {
    /* Ensure tables are scrollable */
    .table-container {
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    /* Better spacing for mobile */
    .view {
        padding: 0;
    }

    .view-header {
        padding: 0 0.5rem;
    }

    /* Stack form elements better */
    .form-group {
        margin-bottom: 1.25rem;
    }

    /* Make modals more mobile-friendly */
    .modal-content {
        max-height: 90vh;
        overflow-y: auto;
    }

    /* Better button spacing */
    .btn-group {
        flex-direction: column;
        width: 100%;
    }

    .btn-group .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    /* Dashboard stats */
    .stat-card .stat-icon {
        font-size: 2rem;
    }

    .stat-card .stat-value {
        font-size: 1.75rem;
    }

    /* Improve card readability */
    .card {
        padding: 1rem;
    }

    /* Better input sizing */
    input[type="text"],
    input[type="number"],
    input[type="date"],
    input[type="email"],
    select,
    textarea {
        width: 100%;
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Landscape mobile optimization */
@media (max-width: 768px) and (orientation: landscape) {
    .login-card {
        max-width: 500px;
    }

    .sidebar {
        width: 240px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.owner-only {
    display: none !important;
}

.user-role-owner .owner-only {
    display: block !important;
}

/* Hide owner-only views when they're not active */
.view.owner-only:not(.active) {
    display: none !important;
}

.view.owner-only[style*="display: none"] {
    display: none !important;
}

/* Only show owner-only elements inside active views */
.user-role-owner .view.active .owner-only,
.user-role-owner .view[style*="display: block"] .owner-only {
    display: block !important;
}

/* Specifically hide add-user-btn everywhere by default - MAXIMUM AGGRESSIVE */
#add-user-btn {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
    left: -9999px !important;
    pointer-events: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

/* Only show when users-view is active AND visible AND user is owner */
body.user-role-owner #users-view.active[style*="display: block"] #add-user-btn,
body.user-role-owner #users-view.active:not([style*="display: none"]) #add-user-btn {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    width: auto !important;
    position: relative !important;
    left: auto !important;
    pointer-events: auto !important;
    margin: inherit !important;
    padding: inherit !important;
    border: inherit !important;
}

/* Ensure users-view is completely hidden when not active */
#users-view:not(.active) {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
}

#users-view[style*="display: none"] {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
}

/* Hide the entire users-view container when not active */
#users-view:not(.active) * {
    display: none !important;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 400px;
}

.toast {
    background: white;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 300px;
    animation: slideInRight 0.3s ease-out;
    border-left: 4px solid;
    position: relative;
    overflow: hidden;
}

.toast.success {
    border-left-color: var(--success-color);
}

.toast.error {
    border-left-color: var(--danger-color);
}

.toast.warning {
    border-left-color: var(--warning-color);
}

.toast.info {
    border-left-color: var(--primary-color);
}

.toast-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.toast.success .toast-icon {
    color: var(--success-color);
}

.toast.error .toast-icon {
    color: var(--danger-color);
}

.toast.warning .toast-icon {
    color: var(--warning-color);
}

.toast.info .toast-icon {
    color: var(--primary-color);
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.toast-message {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.2s;
}

.toast-close:hover {
    color: var(--text-primary);
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: currentColor;
    opacity: 0.3;
    animation: progressBar linear forwards;
}

.toast.success .toast-progress {
    background: var(--success-color);
}

.toast.error .toast-progress {
    background: var(--danger-color);
}

.toast.warning .toast-progress {
    background: var(--warning-color);
}

.toast.info .toast-progress {
    background: var(--primary-color);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes progressBar {
    from {
        width: 100%;
    }
    to {
        width: 0%;
    }
}

.toast.hiding {
    animation: slideOutRight 0.3s ease-out forwards;
}

/* Transactions View Enhancements */
#transactions-view .view-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

#transactions-view .search-box {
    min-width: 250px;
}

#transactions-view .filter-select {
    min-width: 150px;
}
