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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    min-height: 100vh;
}

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

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

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

.logo h1 {
    color: #333;
    font-size: 24px;
    margin-bottom: 5px;
}

.logo p {
    color: #888;
    font-size: 14px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.error-message {
    margin-top: 15px;
    padding: 10px;
    background-color: #fef2f2;
    color: #dc2626;
    border-radius: 6px;
    text-align: center;
    display: none;
}

.demo-info {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    text-align: center;
    color: #888;
    font-size: 13px;
}

.demo-info p {
    margin: 4px 0;
}

.admin-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    color: white;
    padding: 20px;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding-bottom: 20px;
    border-bottom: 1px solid #334155;
    margin-bottom: 20px;
}

.sidebar-header h2 {
    font-size: 18px;
    margin-bottom: 5px;
}

.sidebar-header p {
    font-size: 13px;
    color: #94a3b8;
}

.nav-menu {
    list-style: none;
}

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

.nav-menu a {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: #cbd5e1;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s;
}

.nav-menu a:hover,
.nav-menu a.active {
    background: rgba(102, 126, 234, 0.2);
    color: white;
}

.nav-menu i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

.main-content {
    margin-left: 250px;
    flex: 1;
    padding: 20px;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.top-bar h1 {
    font-size: 20px;
    color: #333;
}

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

.user-info > span {
    color: #666;
    white-space: nowrap;
}

.user-info button {
    padding: 8px 16px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.user-info button:hover {
    background: #dc2626;
}

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

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.card-header h2 {
    font-size: 16px;
    color: #333;
}

.btn-secondary {
    background: #f1f5f9;
    color: #64748b;
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

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

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.table th {
    background: #f8fafc;
    font-weight: 600;
    color: #475569;
}

.table tr:hover {
    background: #f8fafc;
}

.action-btns {
    display: flex;
    gap: 8px;
}

.action-btns button {
    padding: 5px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.btn-edit {
    background: #3b82f6;
    color: white;
}

.btn-delete {
    background: #ef4444;
    color: white;
}

.btn-view {
    background: #22c55e;
    color: white;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    font-size: 18px;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.close-btn:hover {
    color: #333;
}

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

.form-full {
    grid-column: span 2;
}

.form-group-inline {
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-group-inline input {
    flex: 1;
}

.form-group-inline button {
    padding: 12px 20px;
}

.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-bar input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.search-bar button {
    padding: 10px 20px;
}

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

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

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #667eea;
}

.stat-card .stat-label {
    color: #64748b;
    margin-top: 5px;
}

.order-items-list {
    margin-top: 15px;
}

.order-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    border-bottom: 1px solid #eee;
}

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

.order-summary {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    text-align: right;
}

.order-summary div {
    margin-bottom: 5px;
}

.order-summary .total {
    font-size: 20px;
    font-weight: 700;
    color: #667eea;
}

.payment-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.cart-items {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #eee;
}

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

.cart-item-info h4 {
    margin-bottom: 5px;
}

.cart-item-info p {
    color: #666;
    font-size: 14px;
}

.cart-item-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cart-item-actions button {
    width: 30px;
    height: 30px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
}

.cart-item-actions span {
    min-width: 30px;
    text-align: center;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 20px;
}

.cart-total span:first-child {
    font-weight: 600;
}

.cart-total span:last-child {
    font-size: 24px;
    font-weight: 700;
    color: #667eea;
}

.btn-group {
    display: flex;
    gap: 10px;
}

.sales-chart {
    height: 300px;
    background: #f8fafc;
    border-radius: 8px;
    padding: 20px;
}

.ranking-list {
    list-style: none;
}

.ranking-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #eee;
}

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

.rank-badge {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #667eea;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
    margin-right: 15px;
}

.rank-badge.gold {
    background: #f59e0b;
}

.rank-badge.silver {
    background: #9ca3af;
}

.rank-badge.bronze {
    background: #d97706;
}

.rank-info {
    flex: 1;
}

.rank-info h4 {
    margin-bottom: 5px;
}

.rank-info p {
    color: #666;
    font-size: 14px;
}

.rank-amount {
    font-size: 18px;
    font-weight: 700;
    color: #667eea;
}

.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    width: 45px;
    height: 45px;
    background: #667eea;
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

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

@media (max-width: 768px) {
    html {
        font-size: 14px;
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    .sidebar {
        width: 280px;
        position: fixed;
        left: -280px;
        z-index: 1002;
        transition: left 0.3s ease;
        height: 100vh;
    }
    
    .sidebar.active {
        left: 0;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
        padding: 15px;
        padding-top: 70px;
    }
    
    .top-bar {
        flex-direction: column;
        gap: 15px;
        padding: 12px 15px;
    }
    
    .top-bar h1 {
        font-size: 18px;
    }
    
    .user-info {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }
    
    .user-info > span {
        font-size: 13px;
    }
    
    .user-info button {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .login-box {
        padding: 25px;
        margin: 15px;
    }
    
    .logo h1 {
        font-size: 20px;
    }
    
    .logo p {
        font-size: 12px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .form-full {
        grid-column: span 1;
    }
    
    .form-group label {
        font-size: 14px;
    }
    
    .form-group input {
        padding: 14px 15px;
        font-size: 15px;
    }
    
    .btn {
        padding: 14px;
        font-size: 16px;
    }
    
    .card {
        padding: 15px;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .card-header h2 {
        font-size: 15px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-card .stat-value {
        font-size: 22px;
    }
    
    .stat-card .stat-label {
        font-size: 13px;
    }
    
    .table {
        display: block;
        overflow-x: auto;
    }
    
    .table th,
    .table td {
        padding: 10px 8px;
        font-size: 13px;
        white-space: nowrap;
    }
    
    .action-btns {
        flex-direction: column;
        gap: 5px;
    }
    
    .action-btns button {
        padding: 6px 8px;
        font-size: 12px;
    }
    
    .search-bar {
        flex-direction: column;
    }
    
    .search-bar input {
        padding: 12px 15px;
    }
    
    .search-bar button {
        padding: 12px;
    }
    
    .modal-content {
        margin: 15px;
        padding: 20px;
        max-height: calc(100vh - 30px);
    }
    
    .modal-header h3 {
        font-size: 16px;
    }
    
    .btn-group {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 13px;
    }
    
    .login-box {
        padding: 20px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card .stat-value {
        font-size: 24px;
    }
    
    .main-content {
        padding: 10px;
        padding-top: 60px;
    }
    
    .top-bar {
        padding: 10px;
    }
    
    .card {
        padding: 12px;
    }
    
    .table th,
    .table td {
        padding: 8px 6px;
        font-size: 12px;
    }
    
    .mobile-menu-toggle {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    .sidebar {
        width: 250px;
        left: -250px;
    }
}

.cashier-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 20px;
}

.cashier-cart-panel {
    position: sticky;
    top: 20px;
    height: fit-content;
}

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

.camera-container {
    position: relative;
    max-width: 400px;
    margin: 0 auto;
}

.camera-container video {
    border-radius: 8px;
    width: 100%;
}

#scanRegion {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    border: 3px solid #667eea;
    border-radius: 8px;
    pointer-events: none;
}

.camera-actions {
    text-align: center;
    margin-top: 15px;
}

.scan-result {
    padding: 10px;
    text-align: center;
    display: none;
}

.empty-cart {
    text-align: center;
    padding: 20px;
    color: #999;
}

.discount-info {
    display: none;
    padding: 10px;
    background: #fef3c7;
    border-radius: 8px;
    margin-bottom: 10px;
}

.discount-row {
    display: flex;
    justify-content: space-between;
}

.discount-row:first-child span:first-child {
    color: #b45309;
}

.discount-row:first-child span:last-child {
    font-weight: bold;
    color: #b45309;
}

.discount-row:last-child span:last-child {
    color: #ef4444;
}

.cart-total-final {
    background: #f0fdf4 !important;
}

.cart-total-final span:first-child {
    color: #16a34a;
    font-weight: bold;
}

.cart-total-final span:last-child {
    color: #16a34a;
    font-size: 24px;
    font-weight: 700;
}

.btn-large {
    padding: 16px;
    font-size: 17px;
}

@media (orientation: portrait) {
    html {
        font-size: 14px;
    }
    
    .mobile-menu-toggle {
        width: 50px;
        height: 50px;
        font-size: 22px;
        top: 10px;
        left: 10px;
    }
    
    .main-content {
        padding-top: 75px;
        padding-left: 10px;
        padding-right: 10px;
        padding-bottom: 10px;
    }
    
    .login-container {
        padding: 20px;
    }
    
    .login-box {
        padding: 30px 20px;
        margin: 0;
        min-height: 80vh;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    
    .logo h1 {
        font-size: 24px;
        margin-bottom: 8px;
    }
    
    .logo p {
        font-size: 13px;
    }
    
    .form-group {
        margin-bottom: 25px;
    }
    
    .form-group label {
        font-size: 15px;
        margin-bottom: 10px;
        font-weight: 600;
    }
    
    .form-group input {
        padding: 16px 15px;
        font-size: 16px;
        border-radius: 10px;
        border-width: 2px;
    }
    
    .btn {
        padding: 16px;
        font-size: 17px;
        border-radius: 10px;
        font-weight: 600;
    }
    
    .btn-primary:active {
        transform: scale(0.98);
    }
    
    .card {
        padding: 15px;
        margin-bottom: 15px;
        border-radius: 12px;
    }
    
    .card-header {
        padding-bottom: 12px;
        margin-bottom: 15px;
    }
    
    .card-header h2 {
        font-size: 17px;
        font-weight: 600;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .stat-card {
        padding: 20px;
        border-radius: 12px;
    }
    
    .stat-card .stat-value {
        font-size: 32px;
        font-weight: 700;
    }
    
    .stat-card .stat-label {
        font-size: 14px;
        margin-top: 8px;
        color: #64748b;
    }
    
    .table {
        border-radius: 8px;
        overflow: hidden;
    }
    
    .table th,
    .table td {
        padding: 12px 8px;
        font-size: 13px;
        white-space: nowrap;
    }
    
    .table th {
        font-size: 12px;
        font-weight: 600;
        background: #f1f5f9;
    }
    
    .action-btns {
        flex-direction: column;
        gap: 6px;
    }
    
    .action-btns button {
        padding: 8px 12px;
        font-size: 13px;
        border-radius: 6px;
        min-width: 70px;
    }
    
    .search-bar {
        flex-direction: column;
        gap: 10px;
    }
    
    .search-bar input {
        padding: 14px 15px;
        font-size: 16px;
        border-radius: 10px;
    }
    
    .search-bar button {
        padding: 14px;
        font-size: 16px;
    }
    
    .modal-content {
        margin: 10px;
        padding: 25px;
        border-radius: 16px;
        max-height: calc(100vh - 20px);
    }
    
    .modal-header {
        margin-bottom: 20px;
    }
    
    .modal-header h3 {
        font-size: 18px;
        font-weight: 600;
    }
    
    .close-btn {
        font-size: 28px;
        padding: 5px;
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .form-row {
        gap: 15px;
    }
    
    .top-bar {
        padding: 12px 15px;
        gap: 12px;
        border-radius: 12px;
    }
    
    .top-bar h1 {
        font-size: 19px;
        font-weight: 600;
    }
    
    .user-info {
        gap: 10px;
        flex-wrap: wrap;
        justify-content: flex-start;
    }
    
    .user-info > span {
        font-size: 13px;
        white-space: normal;
        line-height: 1.4;
    }
    
    .user-info button {
        padding: 10px 16px;
        font-size: 14px;
        border-radius: 8px;
    }
    
    .cart-items {
        max-height: 250px;
    }
    
    .cart-item {
        padding: 12px;
        border-bottom: 1px solid #e2e8f0;
    }
    
    .cart-item-info h4 {
        font-size: 15px;
        margin-bottom: 4px;
    }
    
    .cart-item-info p {
        font-size: 14px;
    }
    
    .cart-item-actions button {
        width: 36px;
        height: 36px;
        font-size: 18px;
        border-radius: 8px;
    }
    
    .cart-item-actions span {
        min-width: 36px;
        font-size: 16px;
        font-weight: 600;
    }
    
    .cart-total {
        padding: 15px;
        border-radius: 10px;
    }
    
    .cart-total span:last-child {
        font-size: 26px;
    }
    
    .btn-group {
        flex-direction: column;
        gap: 10px;
    }
    
    .ranking-item {
        padding: 12px;
        border-bottom: 1px solid #e2e8f0;
    }
    
    .rank-badge {
        width: 36px;
        height: 36px;
        font-size: 15px;
        margin-right: 12px;
    }
    
    .rank-info h4 {
        font-size: 15px;
        margin-bottom: 3px;
    }
    
    .rank-info p {
        font-size: 13px;
    }
    
    .rank-amount {
        font-size: 18px;
    }
    
    .cashier-layout {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .cashier-cart-panel {
        position: relative !important;
        top: auto !important;
        width: 100%;
    }
    
    #productGrid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
    
    #productGrid .card {
        padding: 12px;
        margin-bottom: 0;
    }
    
    #productGrid .card h3 {
        font-size: 14px;
        margin-bottom: 5px;
    }
    
    #productGrid .card p {
        font-size: 12px;
        margin-bottom: 8px;
    }
    
    #productGrid .card p:last-child {
        font-size: 16px;
        margin-bottom: 0;
    }
    
    #cameraMode video {
        max-height: 250px;
        object-fit: cover;
    }
    
    #scanRegion {
        width: 150px !important;
        height: 150px !important;
    }
}

@media (orientation: portrait) and (max-width: 375px) {
    .mobile-menu-toggle {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
    
    .main-content {
        padding-top: 70px;
        padding-left: 8px;
        padding-right: 8px;
        padding-bottom: 8px;
    }
    
    .login-box {
        padding: 20px;
    }
    
    .logo h1 {
        font-size: 22px;
    }
    
    .form-group input {
        padding: 14px 12px;
        font-size: 15px;
    }
    
    .btn {
        padding: 14px;
        font-size: 16px;
    }
    
    .card {
        padding: 12px;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .stat-card .stat-value {
        font-size: 28px;
    }
    
    .table th,
    .table td {
        padding: 10px 6px;
        font-size: 12px;
    }
    
    .action-btns button {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .top-bar h1 {
        font-size: 17px;
    }
    
    .user-info button {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .cart-item-actions button {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
    
    .cart-total span:last-child {
        font-size: 24px;
    }
    
    #productGrid {
        grid-template-columns: 1fr !important;
    }
}

@media (orientation: landscape) and (max-height: 400px) {
    .mobile-menu-toggle {
        width: 40px;
        height: 40px;
        font-size: 18px;
        top: 8px;
        left: 8px;
    }
    
    .main-content {
        padding-top: 55px;
        padding: 8px;
    }
    
    .login-box {
        padding: 20px;
        min-height: auto;
    }
    
    .logo {
        margin-bottom: 15px;
    }
    
    .logo h1 {
        font-size: 20px;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-group input {
        padding: 12px;
        font-size: 14px;
    }
    
    .btn {
        padding: 12px;
        font-size: 15px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }
    
    .stat-card {
        padding: 12px;
    }
    
    .stat-card .stat-value {
        font-size: 18px;
    }
    
    .stat-card .stat-label {
        font-size: 11px;
    }
    
    .card {
        padding: 10px;
        margin-bottom: 10px;
    }
    
    .card-header h2 {
        font-size: 14px;
    }
    
    .table th,
    .table td {
        padding: 8px 6px;
        font-size: 11px;
    }
}