/* ============================================
   Aplikasi Mobile Reminder Obat Harian Lansia
   Modern Healthcare Mobile-First Design
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Nunito+Sans:wght@300;400;600;700;800&family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #4A90D9;
    --primary-light: #E8F4FD;
    --primary-dark: #2C6FAD;
    --secondary: #6DD5A0;
    --secondary-light: #E8F8F0;
    --accent: #FF8A65;
    --danger: #EF5350;
    --warning: #FFB74D;
    --success: #66BB6A;
    --dark: #2D3748;
    --gray: #718096;
    --gray-light: #E2E8F0;
    --gray-lighter: #F7FAFC;
    --white: #FFFFFF;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --radius: 16px;
    --radius-sm: 10px;
    --radius-lg: 24px;
    --font-primary: 'Poppins', sans-serif;
    --font-secondary: 'Nunito Sans', sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============ ROLE-BASED THEMES ============ */

/* Theme Keluarga - Biru Profesional */
[data-role="keluarga"] {
    --primary: #3B82F6;
    --primary-light: #EFF6FF;
    --primary-dark: #1D4ED8;
    --secondary: #6366F1;
    --secondary-light: #EEF2FF;
    --header-gradient: linear-gradient(135deg, #3B82F6 0%, #1D4ED8 100%);
    --nav-active: #3B82F6;
}

/* Theme Lansia - Hijau Soft & Hangat */
[data-role="lansia"] {
    --primary: #10B981;
    --primary-light: #ECFDF5;
    --primary-dark: #059669;
    --secondary: #F59E0B;
    --secondary-light: #FFFBEB;
    --header-gradient: linear-gradient(135deg, #10B981 0%, #059669 100%);
    --nav-active: #10B981;
}

/* Lansia: larger fonts for readability */
[data-role="lansia"] .header-title {
    font-size: 1.5rem;
}

[data-role="lansia"] .stat-number {
    font-size: 1.8rem;
}

[data-role="lansia"] .schedule-info h6 {
    font-size: 1rem;
}

[data-role="lansia"] .btn-large {
    padding: 20px 32px;
    font-size: 1.2rem;
}

[data-role="lansia"] .reminder-title {
    font-size: 1.4rem;
}

[data-role="lansia"] .reminder-medicine {
    font-size: 1.2rem;
}

[data-role="lansia"] .nav-item i {
    font-size: 1.5rem;
}

[data-role="lansia"] .nav-item span {
    font-size: 0.75rem;
}

/* Dark Mode Variables */
[data-theme="dark"] {
    --primary-light: #1A2332;
    --secondary-light: #1B2E1F;
    --dark: #E2E8F0;
    --gray: #A0AEC0;
    --gray-light: #2D3748;
    --gray-lighter: #1A202C;
    --white: #1E2533;
    --shadow: 0 2px 12px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.4);
}

[data-theme="dark"][data-role="keluarga"] {
    --primary: #60A5FA;
    --primary-dark: #93C5FD;
}

[data-theme="dark"][data-role="lansia"] {
    --primary: #34D399;
    --primary-dark: #6EE7B7;
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    background-color: var(--gray-lighter);
    color: var(--dark);
    max-width: 430px;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    transition: var(--transition);
}

html {
    scroll-behavior: smooth;
}

/* App Container */
.app-container {
    padding-bottom: 80px;
    min-height: 100vh;
    background: var(--gray-lighter);
}

/* Gradient Header */
.app-header {
    background: var(--header-gradient, linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%));
    padding: 20px 20px 30px;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    color: white;
    position: relative;
    overflow: hidden;
}

.app-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
}

.app-header::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 150px;
    height: 150px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
}

.header-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.header-subtitle {
    font-size: 0.85rem;
    opacity: 0.85;
    font-weight: 400;
}

/* Modern Cards */
.card-modern {
    background: var(--white);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 14px;
    box-shadow: var(--shadow);
    border: none;
    transition: var(--transition);
}

.card-modern:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 16px 20px;
    margin-top: -20px;
    position: relative;
    z-index: 10;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    font-size: 1.3rem;
}

.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--secondary-light); color: var(--secondary); }
.stat-icon.orange { background: #FFF3E0; color: var(--accent); }
.stat-icon.red { background: #FFEBEE; color: var(--danger); }

.stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--gray);
    margin-top: 2px;
}

/* Progress Bar */
.progress-section {
    padding: 0 20px;
    margin-bottom: 16px;
}

.progress-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.progress-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--dark);
}

.progress-percent {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary);
}

.progress-bar-custom {
    height: 10px;
    background: var(--gray-light);
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 10px;
    transition: width 1s ease;
}

/* Schedule Cards */
.schedule-section {
    padding: 0 20px;
}

.section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.schedule-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 14px;
    transition: var(--transition);
    border-left: 4px solid var(--primary);
}

.schedule-card.urgent {
    border-left-color: var(--danger);
}

.schedule-card.done {
    border-left-color: var(--success);
    opacity: 0.7;
}

.schedule-time {
    background: var(--primary-light);
    color: var(--primary);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.85rem;
    text-align: center;
    min-width: 60px;
}

.schedule-info h6 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 2px;
}

.schedule-info p {
    font-size: 0.78rem;
    color: var(--gray);
    margin: 0;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 430px;
    background: var(--white);
    border-top: 1px solid var(--gray-light);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 0 12px;
    z-index: 1000;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.06);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--gray);
    font-size: 0.7rem;
    padding: 4px 12px;
    border-radius: 12px;
    transition: var(--transition);
}

.nav-item.active {
    color: var(--primary);
}

.nav-item.active i {
    background: var(--primary-light);
    color: var(--primary);
}

.nav-item i {
    font-size: 1.3rem;
    margin-bottom: 3px;
    padding: 6px 14px;
    border-radius: 12px;
    transition: var(--transition);
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: 85px;
    right: calc(50% - 195px);
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    box-shadow: 0 4px 20px rgba(74, 144, 217, 0.4);
    cursor: pointer;
    transition: var(--transition);
    z-index: 999;
    border: none;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(74, 144, 217, 0.5);
}

/* Buttons */
.btn-primary-custom {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: var(--radius-sm);
    padding: 14px 28px;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    width: 100%;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(74, 144, 217, 0.3);
}

.btn-primary-custom:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 144, 217, 0.4);
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: white;
}

.btn-success-custom {
    background: linear-gradient(135deg, #10B981, #059669);
    border: none;
    border-radius: var(--radius-sm);
    padding: 14px 28px;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    width: 100%;
    transition: var(--transition);
}

.btn-success-custom:hover {
    color: white;
    transform: translateY(-2px);
}

.btn-danger-custom {
    background: linear-gradient(135deg, var(--danger), #D32F2F);
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px 24px;
    color: white;
    font-weight: 600;
    transition: var(--transition);
}

.btn-outline-custom {
    border: 2px solid var(--primary);
    color: var(--primary);
    background: transparent;
    border-radius: var(--radius-sm);
    padding: 12px 24px;
    font-weight: 600;
    transition: var(--transition);
}

.btn-outline-custom:hover {
    background: var(--primary);
    color: white;
}

/* Large Button for Elderly */
.btn-large {
    padding: 18px 32px;
    font-size: 1.1rem;
    border-radius: var(--radius);
}

/* Form Styles */
.form-control-modern {
    border: 2px solid var(--gray-light);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    font-size: 0.95rem;
    transition: var(--transition);
    background: var(--white);
    color: var(--dark);
}

.form-control-modern:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(74, 144, 217, 0.1);
    outline: none;
}

.form-label-modern {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--dark);
    margin-bottom: 6px;
}

/* Login & Register Page */
.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 30px 24px;
    background: linear-gradient(180deg, var(--primary-light) 0%, var(--gray-lighter) 100%);
}

.auth-logo {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo i {
    font-size: 3.5rem;
    color: var(--primary);
    background: var(--primary-light);
    padding: 20px;
    border-radius: 50%;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    color: var(--dark);
    margin-bottom: 6px;
}

.auth-subtitle {
    font-size: 0.9rem;
    text-align: center;
    color: var(--gray);
    margin-bottom: 30px;
}

.auth-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    box-shadow: var(--shadow-lg);
}

/* Splash Screen */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.splash-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.splash-icon {
    font-size: 4rem;
    color: white;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

.splash-title {
    color: white;
    font-size: 1.4rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
}

.splash-subtitle {
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Reminder Popup */
.reminder-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

.reminder-popup {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    width: 90%;
    max-width: 360px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.4s ease;
}

.reminder-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 2rem;
    color: white;
    animation: pulse 1.5s infinite;
}

.reminder-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 8px;
}

.reminder-medicine {
    font-size: 1rem;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 4px;
}

.reminder-dose {
    font-size: 0.85rem;
    color: var(--gray);
    margin-bottom: 24px;
}

/* Toast Notification */
.toast-custom {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--dark);
    color: white;
    padding: 14px 24px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    z-index: 10000;
    box-shadow: var(--shadow-lg);
    animation: slideDown 0.3s ease;
    max-width: 380px;
    width: 90%;
    text-align: center;
}

.toast-custom.success { background: var(--success); }
.toast-custom.error { background: var(--danger); }
.toast-custom.warning { background: var(--warning); color: var(--dark); }

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes slideDown {
    from { transform: translate(-50%, -100%); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

@keyframes fadeInUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Badge Status */
.badge-status {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
}

.badge-diminum { background: #E8F5E9; color: #2E7D32; }
.badge-terlewat { background: #FFEBEE; color: #C62828; }
.badge-belum { background: #FFF3E0; color: #E65100; }

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
}

.empty-state i {
    font-size: 3.5rem;
    color: var(--gray-light);
    margin-bottom: 16px;
}

.empty-state h5 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.85rem;
    color: var(--gray);
}

/* Modal Custom */
.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--gray-light);
    padding: 18px 24px;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    border-top: 1px solid var(--gray-light);
    padding: 16px 24px;
}

/* Search Bar */
.search-bar {
    padding: 12px 20px;
}

.search-input {
    background: var(--white);
    border: 2px solid var(--gray-light);
    border-radius: 30px;
    padding: 12px 20px 12px 44px;
    width: 100%;
    font-size: 0.9rem;
    transition: var(--transition);
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(74, 144, 217, 0.1);
    outline: none;
}

.search-icon {
    position: absolute;
    left: 34px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
}

/* Profile Page */
.profile-header {
    text-align: center;
    padding: 30px 20px;
}

.profile-avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    font-size: 2.2rem;
    color: white;
    box-shadow: 0 4px 20px rgba(74, 144, 217, 0.3);
}

.profile-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--dark);
}

.profile-role {
    font-size: 0.85rem;
    color: var(--gray);
    text-transform: capitalize;
}

/* Menu List */
.menu-list {
    padding: 0 20px;
}

.menu-item {
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--dark);
    transition: var(--transition);
}

.menu-item:hover {
    transform: translateX(4px);
    color: var(--primary);
}

.menu-item i {
    font-size: 1.2rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--primary-light);
    color: var(--primary);
}

.menu-item span {
    font-weight: 500;
    font-size: 0.9rem;
}

.menu-item .bi-chevron-right {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--gray);
    background: none;
    width: auto;
    height: auto;
}

/* Loading Animation */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--gray-light);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Table Responsive */
.table-modern {
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.table-modern th {
    background: var(--primary-light);
    color: var(--primary-dark);
    font-weight: 600;
    font-size: 0.8rem;
    padding: 12px;
    border: none;
}

.table-modern td {
    padding: 12px;
    font-size: 0.82rem;
    vertical-align: middle;
    border-color: var(--gray-light);
    color: var(--dark);
}

/* Monitoring Card */
.monitoring-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 14px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
}

.monitoring-card .user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.monitoring-card .user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1.2rem;
}

/* Dark Mode Toggle */
.dark-mode-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 10px;
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
    background: var(--gray-light);
    border-radius: 13px;
    cursor: pointer;
    transition: var(--transition);
}

.toggle-switch.active {
    background: var(--primary);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
}

.toggle-switch.active::after {
    left: 27px;
}

/* Notification Badge */
.notif-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    background: var(--danger);
    border-radius: 50%;
    font-size: 0.65rem;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* Page Content Padding */
.page-content {
    padding: 20px;
    animation: fadeInUp 0.4s ease;
}

/* Responsive Utilities */
@media (max-width: 430px) {
    body { max-width: 100%; }
    .fab { right: 20px; }
}
