/* Variables & Color Palette - Modern Premium Aesthetics */
:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --secondary: #f3f4f6;
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --success: #10b981;
    --success-light: #d1fae5;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px 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);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    box-shadow: var(--shadow-sm);
    z-index: 10;
}

.logo-container {
    display: flex;
    align-items: center;
    padding: 0 24px 30px;
    gap: 12px;
}

.logo-container .icon {
    font-size: 28px;
    color: var(--primary);
    background: #eef2ff;
    padding: 8px;
    border-radius: 12px;
}

.logo-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.nav-list {
    list-style: none;
    flex: 1;
}

.nav-list li {
    margin: 4px 16px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: 10px;
    transition: var(--transition);
    gap: 14px;
    font-weight: 500;
}

.nav-link:hover {
    background-color: var(--secondary);
    color: var(--text-main);
}

.nav-link.active {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
}

.nav-link .icon {
    font-size: 20px;
}

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

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

.header-title h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

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

.time-display {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--secondary);
    padding: 8px 16px;
    border-radius: 20px;
}

.user-profile img {
    border-radius: 50%;
    width: 40px;
    height: 40px;
    border: 2px solid var(--border);
}

/* Views Container */
.views-container {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    position: relative;
}

.view {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.view.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    background-color: #eef2ff;
    color: var(--primary);
}

.stat-icon.income { background-color: var(--success-light); color: var(--success); }
.stat-icon.danger { background-color: var(--danger-light); color: var(--danger); }

.stat-details {
    flex: 1;
    min-width: 0;
}

.stat-details h3 {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    word-break: break-word;
}

/* Tables & Cards */
.table-card {
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

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

.view-header {
    background: transparent;
    padding: 0 0 24px 0;
    border: none;
}

.card-header h2, .view-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 12px;
}

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

.data-table th, .data-table td {
    padding: 16px 24px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background-color: #f8fafc;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    font-size: 14px;
    color: var(--text-main);
}

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

.data-table tbody tr:hover {
    background-color: #f8fafc;
}

/* UI Elements */
.btn {
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

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

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

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

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

.btn-icon-only {
    padding: 8px;
    font-size: 18px;
}

.btn-block { width: 100%; }
.btn-lg { padding: 14px; font-size: 16px; }

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* POS Layout */
.pos-layout {
    display: grid;
    grid-template-columns: 2fr 1.2fr;
    gap: 24px;
    height: 100%;
    min-height: 600px;
}

.pos-products-area {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.pos-search {
    position: relative;
    margin: 16px 0 24px;
}

.pos-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 20px;
}

.pos-search input {
    padding-left: 44px;
}

.pos-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    overflow-y: auto;
    padding-right: 8px;
}

.pos-product-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.pos-product-card:hover {
    border-color: var(--primary);
    background-color: #eef2ff;
}

.pos-product-card h4 {
    font-size: 14px;
    margin-bottom: 8px;
    color: var(--text-main);
}

.pos-product-card .price {
    font-weight: 700;
    color: var(--primary);
}

.pos-bill-area {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.bill-header { border-bottom: 1px solid var(--border); padding-bottom: 16px; margin-bottom: 16px; }
.bill-header p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.bill-items {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 24px;
}

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

.bill-item-details { flex: 1; }
.bill-item-details h4 { font-size: 14px; margin-bottom: 4px; }
.bill-item-details p { font-size: 13px; color: var(--text-muted); }

.bill-item-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.qty-control {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--secondary);
    border-radius: 6px;
    padding: 4px;
}

.qty-btn { border: none; background: white; border-radius: 4px; width: 24px; height: 24px; cursor: pointer; }
.item-total { font-weight: 600; width: 60px; text-align: right; }

.bill-summary {
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 14px;
}

.summary-row.total {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 24px;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: var(--bg-card);
    width: 100%;
    max-width: 440px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    display: none;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal.active {
    display: block;
    transform: translateY(0);
}

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

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

.modal-body { padding: 24px; }
.modal-footer { padding: 20px 24px; border-top: 1px solid var(--border); }

.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 500; }

/* Text colors */
.text-danger { color: var(--danger); font-weight: 600; }

/* Tabs for Reports */
.tabs-header { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.tab-btn { background: none; border: none; padding: 12px 24px; font-weight: 500; cursor: pointer; border-bottom: 2px solid transparent; color: var(--text-muted); }
.tab-btn.active { border-bottom-color: var(--primary); color: var(--primary); }

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Print Styles */
@media print {
    body * { visibility: hidden; }
    #print-area, #print-area * { visibility: visible; }
    #print-area { position: absolute; left: 0; top: 0; width: 80mm; padding: 10px; font-family: monospace; font-size: 12px; }
    .receipt-header, .receipt-footer { text-align: center; }
    .receipt-table { width: 100%; border-collapse: collapse; margin-block: 10px; }
    .receipt-table th, .receipt-table td { text-align: left; padding: 2px 0; }
    .receipt-table th:last-child, .receipt-table td:last-child { text-align: right; }
    .receipt-total { display: flex; justify-content: space-between; font-weight: bold; font-size: 14px; margin-block: 10px; }
}

/* Receipt Display hidden when not printing */
.receipt { font-family: monospace; }
.receipt-header, .receipt-footer { text-align: center; margin-block: 10px; }
.receipt-table { width: 100%; margin-block: 10px; }
.receipt-total { display: flex; justify-content: space-between; font-weight: bold; margin-block: 10px; font-size: 16px; }

/* Authentication UI */
.auth-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-body);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.auth-overlay.active { display: flex; }

.app-wrapper { display: flex; width: 100%; height: 100%; }

.auth-box {
    background: var(--bg-card);
    width: 100%;
    max-width: 400px;
    padding: 32px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.auth-header { text-align: center; margin-bottom: 24px; }
.auth-header h2 { font-size: 22px; color: var(--primary); margin-bottom: 8px; }
.auth-header p { font-size: 14px; color: var(--text-muted); }

.auth-form { display: none; }
.auth-form.active { display: block; animation: fadeIn 0.4s ease forwards; }

.auth-switch {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-muted);
}
.auth-switch span {
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
}
.auth-switch span:hover { text-decoration: underline; }

/* ==== SUBSCRIPTION CARD ==== */
.subscription-card {
    position: relative;
    border-radius: 20px;
    padding: 3px;
    margin-bottom: 28px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    overflow: hidden;
    animation: gradientShift 6s ease infinite;
    background-size: 200% 200%;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.subscription-card-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 60%);
    animation: glowRotate 8s linear infinite;
    pointer-events: none;
}

@keyframes glowRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.subscription-card-content {
    background: var(--bg-card);
    border-radius: 18px;
    padding: 32px;
    position: relative;
    z-index: 1;
}

.subscription-badge {
    display: inline-block;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: white;
    padding: 6px 16px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 20px;
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
    50% { transform: scale(1.03); box-shadow: 0 0 20px 4px rgba(245, 158, 11, 0.2); }
}

.subscription-plan-name {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.subscription-plan-desc {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 20px;
    max-width: 500px;
}

.subscription-price {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 24px;
}

.price-amount {
    font-size: 40px;
    font-weight: 800;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -1px;
}

.price-period {
    font-size: 16px;
    color: var(--text-muted);
    font-weight: 500;
}

.subscription-features {
    list-style: none;
    padding: 0;
    margin: 0 0 28px 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.subscription-features li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-main);
    font-weight: 500;
}

.subscription-features li i {
    color: var(--success);
    font-size: 18px;
}

.btn-subscribe {
    background: linear-gradient(135deg, #25d366, #128c7e);
    color: white;
    padding: 14px 32px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.3);
}

.btn-subscribe:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(37, 211, 102, 0.4);
}

.btn-subscribe i {
    font-size: 22px;
}

.subscription-notice {
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-muted);
    font-style: italic;
}

.subscription-status {
    position: absolute;
    top: 32px;
    right: 32px;
}

.status-active {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--success-light);
    color: var(--success);
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 600;
}

.status-trial {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fef3c7;
    color: #d97706;
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 600;
}

.status-expired {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--danger-light);
    color: var(--danger);
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 600;
}

/* ==== TRIAL EXPIRED OVERLAY ==== */
.trial-expired-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    background: linear-gradient(135deg, rgba(248,250,252,0.9), rgba(241,245,249,0.95));
    border-radius: 20px;
    border: 2px dashed var(--border);
    margin-bottom: 28px;
}

.trial-expired-box {
    text-align: center;
    max-width: 420px;
}

.trial-expired-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--danger-light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 36px;
    color: var(--danger);
    animation: lockBounce 2s ease-in-out infinite;
}

@keyframes lockBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

.trial-expired-box h3 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 12px;
}

.trial-expired-box p {
    font-size: 15px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 24px;
}

/* ==== IMAGE SIZE NOTICE ==== */
.image-size-notice {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
    font-size: 12px;
    color: var(--text-muted);
    background: #fef3c7;
    padding: 6px 12px;
    border-radius: 8px;
    margin-top: 8px;
}

.image-size-notice i {
    color: #d97706;
    font-size: 14px;
}
