/* Diwello Shop - Point of Sale Styles */

:root {
    --primary-color: #6b8f71;
    --primary-hover: #5a7d60;
    --secondary-color: #6b7280;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;

    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --border-color: #e5e7eb;
    --text-color: #1f2937;
    --text-muted: #6b7280;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    --radius: 8px;
    --radius-sm: 4px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-color);
    background-color: var(--bg-color);
}

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

a:hover {
    text-decoration: underline;
}

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #ccd5ae 0%, #a4ac86 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 40px;
}

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

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

.login-logo {
    max-width: 150px;
    height: auto;
    margin-bottom: 15px;
}

.back-home-btn {
    display: block;
    text-align: center;
    margin-top: 20px;
    padding: 10px;
    color: var(--text-muted);
    font-size: 14px;
    transition: color 0.2s;
}

.back-home-btn:hover {
    color: var(--primary-color);
    text-decoration: none;
}

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

/* Forms */
.form-group {
    margin-bottom: 16px;
}

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

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group select {
    padding-right: 32px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.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(16, 185, 129, 0.1);
}

.form-group small {
    display: block;
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 12px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

.btn:hover {
    text-decoration: none;
}

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

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

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

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

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

.btn-block {
    width: 100%;
}

a.btn-admin,
.btn-admin {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    font-weight: 600;
    letter-spacing: 0.5px;
}

a.btn-admin:hover,
.btn-admin:hover {
    background: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%);
    color: white;
    text-decoration: none;
}

a.btn-rentals,
.btn-rentals {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    font-weight: 600;
    letter-spacing: 0.5px;
}

a.btn-rentals:hover,
.btn-rentals:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: white;
    text-decoration: none;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Shop Layout - Sidebar Style */
:root {
    --sidebar-width: 250px;
    --header-height: 60px;
}

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: #6c757d;
    color: #e5e7eb;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
}

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

.sidebar-header img {
    max-width: 173px;
    height: auto;
}

.sidebar-nav {
    padding: 16px 0;
}

.sidebar-section {
    margin-bottom: 8px;
}

.sidebar-section-title {
    padding: 8px 20px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #9ca3af;
    font-weight: 600;
}

.sidebar-search {
    padding: 0 12px;
    margin-bottom: 10px;
    display: flex;
    gap: 0;
}

.sidebar-search input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #9ca3af;
    border-right: none;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    background: #9ca3af;
    color: #1f2937;
    font-size: 13px;
}

.sidebar-search input::placeholder {
    color: #6b7280;
}

.sidebar-search input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: #b0b8c1;
}

.sidebar-search button {
    padding: 8px 12px;
    background: var(--primary-color);
    border: 1px solid var(--primary-color);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-search button:hover {
    background: var(--primary-hover);
}

/* Toggle Switch */
.sidebar-toggle {
    display: flex;
    flex-direction: row-reverse;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #4b5563;
    border-radius: 20px;
    transition: 0.2s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--primary-color);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(16px);
}

.toggle-label {
    font-size: 12px;
    color: #9ca3af;
    line-height: 1.3;
}

/* Sidebar Filter */
.sidebar-filter {
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-filter .filter-label {
    font-size: 12px;
    color: #9ca3af;
    white-space: nowrap;
}

.sidebar-filter .filter-select {
    padding: 5px 24px 5px 8px;
    background: #9ca3af;
    border: 1px solid #9ca3af;
    border-radius: var(--radius-sm);
    color: #1f2937;
    font-size: 12px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    -webkit-appearance: none;
    appearance: none;
    min-width: 60px;
}

.sidebar-filter .filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: #d1d5db;
    transition: all 0.15s;
    text-decoration: none;
}

.nav-item:hover {
    background-color: #5a6268;
    color: white;
    text-decoration: none;
}

.nav-item.active {
    background-color: #8ecae6;
    color: #1f2937;
}

.nav-item svg {
    flex-shrink: 0;
}

.nav-divider {
    height: 1px;
    background-color: #5a6268;
    margin: 16px 0;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

/* Header */
.header {
    height: var(--header-height);
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}

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

.header-left h2 {
    font-size: 18px;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
    transition: background 0.2s;
}

.user-menu:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-color);
}

.page-content {
    padding: 24px;
}

/* Legacy layout support */
.shop-header {
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.shop-logo img {
    height: 36px;
    width: auto;
}

.shop-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--primary-color);
}

.shop-header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
}

.shop-content {
    flex: 1;
    padding: 24px;
}

/* Dashboard */
.shop-dashboard {
    max-width: 1400px;
    margin: 0 auto;
}

/* Stats Row - Light Blue Tint */
.stats-row {
    margin-bottom: 24px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.stat-box {
    background: rgba(142, 202, 230, 0.25);
    border: 1px solid rgba(142, 202, 230, 0.3);
    border-radius: 6px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    transition: all 0.3s ease;
    min-height: 88px;
}

.stat-box.clickable {
    cursor: pointer;
}

.stat-box.clickable:hover {
    background: rgba(142, 202, 230, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    color: #1f2937;
    flex-shrink: 0;
}

.stat-content {
    flex: 1;
}

.stat-hint {
    position: absolute;
    bottom: 8px;
    right: 12px;
    font-size: 10px;
    color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.2s;
}

.stat-box.clickable:hover .stat-hint {
    opacity: 1;
}

.stat-label {
    font-size: 12px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: #1f2937;
}

@media (max-width: 768px) {
    .stats-row {
        grid-template-columns: 1fr;
    }
}

/* Filter Section */
.filter-section {
    background: white;
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.filter-form {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.search-input {
    flex: 1;
    min-width: 250px;
    position: relative;
}

.search-input svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-input input {
    width: 100%;
    padding: 10px 12px 10px 40px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
}

.search-input input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.filter-form select {
    padding: 10px 32px 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    min-width: 150px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-color: var(--card-bg);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Products Section */
.products-section {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.products-section h2 {
    font-size: 18px;
    margin-bottom: 16px;
}

.products-section h2 .count {
    color: var(--text-muted);
    font-weight: normal;
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.product-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
    overflow: hidden;
}

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

.product-card.out-of-stock {
    opacity: 0.6;
    cursor: not-allowed;
}

.product-card.out-of-stock:hover {
    transform: none;
    border-color: var(--border-color);
}

.product-image {
    aspect-ratio: 1;
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-info {
    padding: 12px;
}

.product-info h3 {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-sku {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.product-price {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-color);
}

.product-price .original-price {
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: line-through;
    margin-right: 6px;
    font-weight: normal;
}

.product-stock {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.product-stock.low {
    color: var(--warning-color);
}

.out-of-stock-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--danger-color);
    color: white;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    opacity: 0.5;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    color: var(--text-color);
    margin-bottom: 8px;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.page-info {
    color: var(--text-muted);
}

/* Sales Section */
.sales-section {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.sales-section h2 {
    font-size: 18px;
    margin-bottom: 16px;
}

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

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

.sales-table th,
.sales-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.sales-table th {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
}

.sales-table td small {
    color: var(--text-muted);
}

.text-muted {
    color: var(--text-muted);
}

/* Modal */
.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;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-width: 400px;
    width: 90%;
}

.modal.modal-large {
    max-width: 700px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal.modal-large .modal-body {
    overflow-y: auto;
    flex: 1;
}

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

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

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
}

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

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Sale Form */
.sale-product-info {
    background: var(--bg-color);
    padding: 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
}

.sale-product-info h4 {
    font-size: 16px;
    margin-bottom: 4px;
}

.sale-product-price {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary-color);
}

.quantity-input {
    display: flex;
    align-items: center;
    gap: 0;
}

.quantity-input input {
    width: 80px;
    text-align: center;
    border-radius: 0;
    -moz-appearance: textfield;
}

.quantity-input input::-webkit-outer-spin-button,
.quantity-input input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.qty-btn {
    width: 40px;
    height: 40px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-btn:first-child {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.qty-btn:last-child {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.qty-btn:hover {
    background: var(--border-color);
}

.sale-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--primary-color);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 18px;
    font-weight: 600;
    margin-top: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

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

    .main-content {
        margin-left: 0;
    }

    .page-content {
        padding: 16px;
    }

    .shop-header {
        padding: 12px 16px;
    }

    .shop-content {
        padding: 16px;
    }

    .filter-form {
        flex-direction: column;
    }

    .search-input {
        width: 100%;
    }

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

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

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

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
    }
}

/* Today's Sales Modal */
.today-summary {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.summary-item {
    flex: 1;
    background: var(--bg-color);
    padding: 16px;
    border-radius: var(--radius-sm);
    text-align: center;
}

.summary-item.highlight {
    background: var(--primary-color);
    color: white;
}

.summary-label {
    display: block;
    font-size: 12px;
    text-transform: uppercase;
    opacity: 0.8;
    margin-bottom: 4px;
}

.summary-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
}

.summary-item.highlight .summary-label {
    color: rgba(255, 255, 255, 0.9);
}

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

.today-sales-list .sales-table {
    width: 100%;
}

.today-sales-list .sales-table th {
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
}

.today-sales-list .badge {
    background: var(--primary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

@media (max-width: 600px) {
    .today-summary {
        flex-direction: column;
    }

    .modal.modal-large {
        max-height: 90vh;
    }
}
