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

:root {
    --bg-dark: #090d16;
    --glass-bg: rgba(255, 255, 255, 0.04);
    --glass-bg-hover: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-focus: rgba(255, 255, 255, 0.2);
    --text-primary: #f3f4f6;
    --text-muted: #9ca3af;
    
    --color-primary: #6366f1;
    --color-primary-grad: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --color-success: #10b981;
    --color-success-grad: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --color-danger: #f43f5e;
    --color-danger-grad: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
    --color-info: #06b6d4;
    --color-info-grad: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    
    --shadow-main: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    --blur-strength: 16px;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Background Blobs for Glass Depth Effect */
.bg-blob {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    z-index: -1;
    opacity: 0.45;
    pointer-events: none;
    animation: blob-float 20s infinite alternate ease-in-out;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #6366f1 0%, rgba(99, 102, 241, 0) 70%);
    top: -100px;
    left: -100px;
}

.blob-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #a855f7 0%, rgba(168, 85, 247, 0) 70%);
    bottom: -150px;
    right: -100px;
    animation-delay: -5s;
}

.blob-3 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, #06b6d4 0%, rgba(6, 182, 212, 0) 70%);
    top: 50%;
    left: 40%;
    transform: translate(-50%, -50%);
    animation-delay: -10s;
}

@keyframes blob-float {
    0% {
        transform: translate(0, 0) scale(1);
    }
    50% {
        transform: translate(40px, -60px) scale(1.1);
    }
    100% {
        transform: translate(-20px, 30px) scale(0.95);
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Glassmorphism Utility */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--blur-strength)) saturate(180%);
    -webkit-backdrop-filter: blur(var(--blur-strength)) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--shadow-main);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-panel:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    text-decoration: none;
    font-size: 14px;
}

.btn-primary {
    background: var(--color-primary-grad);
    color: #fff;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-danger {
    background: var(--color-danger-grad);
    color: #fff;
    box-shadow: 0 4px 15px rgba(244, 63, 94, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(244, 63, 94, 0.4);
}

.btn-glass {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
}

.btn-glass:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

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

/* Form Controls */
.form-group {
    margin-bottom: 20px;
    width: 100%;
}

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

.form-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 15px;
    transition: all 0.2s ease;
}

.form-input:focus {
    border-color: var(--color-primary);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.15);
}

/* Wrapper Layouts */
#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Authentication Screen */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 40px 30px;
    text-align: center;
    animation: fade-in-up 0.5s ease;
}

.auth-logo {
    font-size: 32px;
    font-weight: 700;
    background: var(--color-primary-grad);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.auth-subtitle {
    color: var(--text-muted);
    font-size: 15px;
    margin-bottom: 30px;
}

.auth-card h2 {
    font-size: 24px;
    margin-bottom: 24px;
}

.auth-footer {
    margin-top: 24px;
    font-size: 14px;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Main Dashboard Workspace */
.dashboard-container {
    display: flex;
    flex: 1;
    min-height: 100vh;
    flex-direction: row;
}

/* Sidebar */
.sidebar {
    width: 280px;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    height: 100vh;
    background: rgba(9, 13, 22, 0.4);
    backdrop-filter: blur(20px);
}

.sidebar-brand {
    font-size: 22px;
    font-weight: 700;
    background: var(--color-primary-grad);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-user {
    padding: 15px;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-primary-grad);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 16px;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.2);
}

.user-details h4 {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.user-details span {
    font-size: 12px;
    color: var(--text-muted);
}

.shop-list-container {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 20px;
}

.shop-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 0 5px;
}

.shop-list-header h3 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
}

.shop-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.shop-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.01);
}

.shop-item:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.05);
}

.shop-item.active {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.2);
    color: #fff;
}

.shop-item-name {
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 170px;
}

.shop-item-actions {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.shop-item:hover .shop-item-actions {
    opacity: 1;
}

.btn-icon-sm {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-icon-sm:hover {
    background: rgba(244, 63, 94, 0.15);
    color: var(--color-danger);
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid var(--glass-border);
}

/* Main Content Area */
.main-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    height: 100vh;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 35px;
}

.page-title h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.page-title p {
    color: var(--text-muted);
    font-size: 14px;
}

/* Timezone Banner */
.tz-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    background: rgba(6, 182, 212, 0.08);
    border: 1px solid rgba(6, 182, 212, 0.2);
    color: #22d3ee;
    font-size: 12px;
    font-weight: 500;
}

/* Stats Section */
.stats-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.stats-title {
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.stats-period-selector {
    display: flex;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    padding: 3px;
    border-radius: 8px;
    gap: 2px;
    margin-bottom: 20px;
}

.period-tab {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.period-tab.active {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

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

.stat-card {
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.stat-card.credit::before {
    background: var(--color-success-grad);
}

.stat-card.debit::before {
    background: var(--color-danger-grad);
}

.stat-card.profit::before {
    background: var(--color-info-grad);
}

.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 12px;
}

.stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.credit .stat-icon {
    background: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
}

.debit .stat-icon {
    background: rgba(244, 63, 94, 0.1);
    color: var(--color-danger);
}

.profit .stat-icon {
    background: rgba(6, 182, 212, 0.1);
    color: var(--color-info);
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}

.stat-card.profit-neg .stat-value {
    color: var(--color-danger);
}

.stat-card.profit-pos .stat-value {
    color: var(--color-success);
}

.stat-desc {
    font-size: 12px;
    color: var(--text-muted);
}

/* Workspace Panels */
.workspace-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

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

.panel-header h2 {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-body {
    padding: 24px;
}

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

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

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

.empty-state p {
    font-size: 14px;
    max-width: 320px;
    margin: 0 auto 20px;
}

/* Transactions Table */
.table-container {
    overflow-x: auto;
    width: 100%;
}

.transaction-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.transaction-table th {
    padding: 12px 16px;
    border-bottom: 1px solid var(--glass-border);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.transaction-table td {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 14px;
}

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

.transaction-table tbody tr {
    transition: background-color 0.2s ease;
}

.transaction-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.015);
}

.badge-type {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-type.credit {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.badge-type.debit {
    background: rgba(244, 63, 94, 0.08);
    border: 1px solid rgba(244, 63, 94, 0.2);
    color: #fb7185;
}

.tx-amount-display {
    font-weight: 600;
}

.tx-amount-display.credit {
    color: #34d399;
}

.tx-amount-display.debit {
    color: #fb7185;
}

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

.tx-desc-display {
    max-width: 250px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.tx-shop-display {
    font-size: 12px;
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text-muted);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(4, 6, 10, 0.7);
    backdrop-filter: blur(6px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

.modal-card {
    width: 100%;
    max-width: 480px;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.modal-overlay.open .modal-card {
    transform: scale(1);
}

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

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

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 10px;
}

/* Alerts and Notifications */
.notification-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1100;
}

.toast {
    padding: 14px 20px;
    border-radius: 10px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    min-width: 280px;
    max-width: 380px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    animation: slide-in-left 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast.success {
    background: rgba(16, 185, 129, 0.85);
    backdrop-filter: blur(10px);
}

.toast.error {
    background: rgba(244, 63, 94, 0.85);
    backdrop-filter: blur(10px);
}

@keyframes slide-in-left {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

/* Screen Transitions */
.hidden {
    display: none !important;
}

/* Responsive Rules */
@media (max-width: 992px) {
    .dashboard-container {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--glass-border);
        position: relative;
    }
    .main-content {
        padding: 24px;
        height: auto;
    }
}

@media (max-width: 600px) {
    .top-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .stats-period-selector {
        width: 100%;
        justify-content: space-between;
    }
    .period-tab {
        flex: 1;
        text-align: center;
        padding: 6px 4px;
        font-size: 11px;
    }
}
