:root {
    --bg-base: #050505;
    --bg-card: #171717;
    --bg-card-hover: #1b1b1b;
    --text-primary: #ffffff;
    --text-secondary: #bdbdbd;
    --accent: #FF2D2D;
    --accent-hover: #ff4a4a;
    --glow: rgba(255, 255, 255, 0.15);
    --glow-accent: rgba(255, 45, 45, 0.2);
    --border-radius: 16px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color-scheme: dark;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    overflow-x: hidden;
    overscroll-behavior-y: none;
    -webkit-font-smoothing: antialiased;
}

/* Typography */
h1, h2, h3 { font-weight: 600; letter-spacing: -0.02em; }
h2 { font-size: 1.25rem; margin-bottom: 1rem; line-height: 1.3; }

/* Utilities */
.w-100 { width: 100%; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }

/* Splash Screen */
.splash-screen {
    position: fixed;
    inset: 0;
    background: var(--bg-base);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}
.logo-glow {
    font-size: 4rem;
    font-weight: 700;
    color: var(--text-primary);
    text-shadow: 0 0 20px var(--glow);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); text-shadow: 0 0 20px var(--glow); }
    50% { transform: scale(1.05); text-shadow: 0 0 40px rgba(255,255,255,0.3); }
    100% { transform: scale(1); text-shadow: 0 0 20px var(--glow); }
}

/* Views */
.view {
    min-height: 100vh;
    display: none;
    flex-direction: column;
}

/* Login */
.login-wrapper {
    margin: auto;
    width: 90%;
    max-width: 400px;
    padding: 2rem;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: 0 8px 32px rgba(0,0,0,0.5), inset 0 1px 1px var(--glow);
    text-align: center;
}
.logo-title {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}
.subtitle {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

/* Forms */
.input-group {
    text-align: left;
    margin-bottom: 1.5rem;
}
.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}
.input-group input, .input-group select {
    width: 100%;
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-primary);
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
}
.input-group input:focus, .input-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--glow-accent);
}
.input-group select option {
    background-color: var(--bg-card);
    color: var(--text-primary);
}

/* Buttons */
button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    outline: none;
}
.btn-primary {
    background: var(--accent);
    color: #fff;
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    transition: var(--transition);
}
.btn-primary:hover, .btn-primary:active {
    background: var(--accent-hover);
    transform: scale(0.98);
}
.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid rgba(255,255,255,0.2);
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 500;
    transition: var(--transition);
}
.btn-outline:active {
    background: rgba(255,255,255,0.05);
}

/* Filter Tabs */
.filter-tabs {
    display: flex;
    gap: 8px;
    background: rgba(255,255,255,0.05);
    padding: 4px;
    border-radius: 14px;
}
.filter-tab {
    flex: 1;
    padding: 10px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    transition: var(--transition);
}
.filter-tab.active {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* App Header */
.topbar {
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(5,5,5,0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 10;
}
.user-info .greeting {
    font-size: 1.1rem;
    font-weight: 600;
}
.role-badge {
    background: rgba(255,255,255,0.1);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    margin-left: 8px;
    vertical-align: middle;
}
.btn-icon {
    background: transparent;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Content */
.content {
    flex: 1;
    padding: 0 20px 100px 20px;
}
.page {
    display: none;
    animation: fadeIn 0.3s ease;
}
.page.active {
    display: block;
}

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

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 30px;
}
.stat-card {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--border-radius);
    border: 1px solid rgba(255,255,255,0.05);
    box-shadow: inset 0 1px 1px var(--glow);
}
.stat-card.accent-glow {
    box-shadow: 0 4px 20px var(--glow-accent), inset 0 1px 1px rgba(255,255,255,0.2);
    border-color: rgba(255,45,45,0.3);
}
.stat-card h3 {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}
.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
}

/* Lists */
.appointments-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.appointment-item {
    background: var(--bg-card);
    padding: 16px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid rgba(255,255,255,0.03);
    transition: transform 0.2s;
}
.appointment-item:active {
    transform: scale(0.98);
}
.app-details {
    flex: 1;
    min-width: 0; /* allows text truncation if needed */
}
.app-details h4 {
    font-size: 0.95rem;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.app-details p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.4;
}
.app-price {
    font-weight: 600;
    color: #00c853;
    font-size: 0.95rem;
    white-space: nowrap;
    text-align: right;
    margin-left: 12px;
}

.list-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.list-item {
    background: var(--bg-card);
    padding: 16px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(23, 23, 23, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    justify-content: space-around;
    padding: 12px 0 24px 0;
    border-top: 1px solid rgba(255,255,255,0.05);
    z-index: 100;
}
.nav-item {
    background: transparent;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    transition: var(--transition);
    flex: 1;
    min-width: 0;
}
.nav-item span {
    font-size: 0.62rem;
    font-weight: 500;
    white-space: nowrap;
}
.nav-item.active {
    color: var(--text-primary);
}
.btn-plus {
    background: var(--accent);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateY(-20px);
    box-shadow: 0 4px 12px var(--glow-accent);
}

/* Forms & Filters */
.filter-tabs {
    display: flex;
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 20px;
}
.filter-tab {
    flex: 1;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 10px 0;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition);
}
.filter-tab.active {
    background: rgba(255,255,255,0.1);
    color: var(--text-primary);
}
.date-picker-wrapper {
    position: relative;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
}
.date-display-text {
    font-size: 0.9rem;
    color: var(--text-primary);
    text-align: center;
    pointer-events: none;
    white-space: nowrap;
}
.date-picker-hidden {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    border: none;
    background: transparent;
}

/* Modals */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    display: none;
    align-items: flex-end;
    z-index: 200;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.modal.active {
    display: flex;
    opacity: 1;
}
.modal-content {
    background: var(--bg-base);
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    border-radius: 24px 24px 0 0;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-top: 1px solid rgba(255,255,255,0.05);
}
.modal.active .modal-content {
    transform: translateY(0);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    position: sticky;
    top: 0;
    background: var(--bg-base);
    padding-bottom: 10px;
    z-index: 10;
}
.btn-close {
    background: rgba(255,255,255,0.1);
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

/* Toasts */
.toast-container {
    position: fixed;
    top: 20px;
    left: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    pointer-events: none;
}
.toast {
    background: rgba(23, 23, 23, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    padding: 12px 20px;
    border-radius: 100px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    animation: toastEnter 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 400px;
}
.toast.success { border-left: 3px solid #00c853; }
.toast.error { border-left: 3px solid #FF2D2D; }
@keyframes toastEnter {
    from { opacity: 0; transform: translateY(-20px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}
.empty-state svg {
    opacity: 0.5;
    margin-bottom: 16px;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.05) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
}
@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
