/* Senior Friendly - iOS/macOS inspired design */
/* Design by Filip Staniec */

:root {
    --bg: #f5f5f7;
    --white: #ffffff;
    --text: #1d1d1f;
    --text-secondary: #86868b;
    --primary: #007aff;
    --primary-hover: #0056cc;
    --success: #34c759;
    --success-hover: #28a745;
    --danger: #ff3b30;
    --danger-hover: #cc2f26;
    --warning: #ff9500;
    --border: #d2d2d7;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 24px rgba(0,0,0,0.12);
    --radius: 16px;
    --radius-sm: 10px;
    --sidebar-width: 260px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

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

/* Layout */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--border);
    padding: 24px 16px;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 8px 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.sidebar-logo svg {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.sidebar-logo span {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.sidebar-nav {
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 2px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 15px;
    font-weight: 500;
    transition: background 0.15s;
}

.sidebar-nav a:hover {
    background: rgba(0,0,0,0.04);
    color: var(--text);
}

.sidebar-nav a.active {
    background: var(--primary);
    color: white;
}

.sidebar-nav .nav-icon {
    width: 20px;
    text-align: center;
    font-size: 18px;
}

.sidebar-user {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px;
    border-top: 1px solid var(--border);
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(20px);
}

.sidebar-user .user-info {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.sidebar-user .user-name {
    font-weight: 600;
    color: var(--text);
    display: block;
}

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

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
}

.page-header p {
    font-size: 15px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.card-header .badge {
    background: var(--primary);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

/* Grid */
.grid {
    display: grid;
    gap: 20px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Stat cards */
.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-card .stat-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.stat-card .stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text);
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-top: 4px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    line-height: 1.4;
}

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

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

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

.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-outline:hover {
    background: rgba(0,0,0,0.04);
    color: var(--text);
}

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

.btn-lg {
    padding: 16px 32px;
    font-size: 18px;
    border-radius: var(--radius);
}

.btn-block {
    display: flex;
    width: 100%;
    justify-content: center;
}

/* Big action buttons for tasks */
.action-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.action-buttons .btn {
    flex: 1;
    padding: 20px;
    font-size: 18px;
    border-radius: var(--radius);
    justify-content: center;
}

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

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

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: inherit;
    background: var(--white);
    color: var(--text);
    transition: border-color 0.15s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,122,255,0.15);
}

select.form-control {
    appearance: none;
    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='%2386868b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-error {
    color: var(--danger);
    font-size: 13px;
    margin-top: 4px;
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
}

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

table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

table td {
    padding: 14px 16px;
    font-size: 15px;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    vertical-align: middle;
}

td:last-child .inline-flex,
td:last-child .flex {
    flex-wrap: nowrap;
    white-space: nowrap;
}

td form {
    display: inline;
}

table tr:hover {
    background: rgba(0,0,0,0.02);
}

/* Task list items */
.task-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 12px;
    transition: transform 0.1s;
}

.task-item:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.task-item .task-type {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.task-type-medication { background: #e8f4fd; }
.task-type-diaper { background: #fef3e2; }
.task-type-custom { background: #f0f0f5; }

.task-item .task-info {
    flex: 1;
    min-width: 0;
}

.task-item .task-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
}

.task-item .task-meta {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.task-item .task-time {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}

/* Status badges */
.status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
}

.status-pending { background: #fef3e2; color: #c77c00; }
.status-completed { background: #e8f8ee; color: #1a8d3e; }
.status-failed { background: #fde8e8; color: #c62828; }

/* Alerts */
.alert {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
}

.alert-success { background: #e8f8ee; color: #1a8d3e; }
.alert-danger { background: #fde8e8; color: #c62828; }
.alert-warning { background: #fef3e2; color: #c77c00; }

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: var(--white);
    border-radius: var(--radius);
    padding: 32px;
    max-width: 480px;
    width: 90%;
    box-shadow: var(--shadow-lg);
}

.modal-box h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 16px;
}

/* Footer */
.footer {
    text-align: center;
    padding: 24px;
    font-size: 13px;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
    margin-top: 40px;
}

/* Login page */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 20px;
}

.login-box {
    background: var(--white);
    border-radius: var(--radius);
    padding: 48px 40px;
    box-shadow: var(--shadow-lg);
    max-width: 420px;
    width: 100%;
    text-align: center;
}

.login-box .login-logo {
    margin-bottom: 32px;
}

.login-box .login-logo svg {
    width: 64px;
    height: 64px;
}

.login-box h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.login-box p {
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 32px;
}

/* Pagination */
.pagination {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 24px;
    list-style: none;
}

.pagination a, .pagination span {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
}

.pagination .active span {
    background: var(--primary);
    color: white;
}

.pagination a:hover {
    background: rgba(0,0,0,0.04);
}

/* Filter bar */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: end;
}

.filter-bar .form-group {
    margin-bottom: 0;
}

/* Mobile hamburger */
.mobile-header {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    z-index: 200;
    align-items: center;
    justify-content: space-between;
}

.hamburger {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    color: var(--text);
}

.mobile-header .logo-text {
    font-weight: 700;
    font-size: 17px;
}

/* Utility */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.inline-flex { display: inline-flex; }

/* Badge variants */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}
.badge-success { background: #e8f8ee; color: #1a8d3e; }
.badge-danger { background: #fde8e8; color: #c62828; }
.badge-warning { background: #fef3e2; color: #c77c00; }
.badge-primary { background: var(--primary); color: white; }

/* Tabs */
.tab-bar {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border);
}

.tab-bar .tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 600;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    border: 1px solid transparent;
    border-bottom: none;
    cursor: pointer;
    text-decoration: none;
    color: var(--text-secondary);
    background: transparent;
    transition: all 0.15s;
    margin-bottom: -2px;
}

.tab-bar .tab:hover {
    color: var(--text);
    background: rgba(0,0,0,0.03);
}

.tab-bar .tab.active {
    color: var(--primary);
    background: var(--white);
    border-color: var(--border);
    border-bottom-color: var(--white);
}

/* Search bar card */
.search-bar {
    background: var(--white);
    border-radius: var(--radius);
    padding: 12px 16px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

/* Responsive improvements */
@media (max-width: 768px) {
    .mobile-header { display: flex; }

    .sidebar {
        transform: translateX(-100%);
    }

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

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.3);
        z-index: 99;
    }

    .sidebar-overlay.active { display: block; }

    .main-content {
        margin-left: 0;
        padding: 80px 16px 24px;
    }

    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        flex-direction: column;
    }

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

    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .page-header h1 {
        font-size: 22px;
    }

    .page-header .flex {
        flex-wrap: wrap;
    }

    table th, table td {
        padding: 10px 12px;
        font-size: 13px;
    }

    .btn {
        padding: 8px 14px;
        font-size: 14px;
    }

    .btn-sm {
        padding: 5px 10px;
        font-size: 12px;
    }

    .tab-bar {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab-bar .tab {
        white-space: nowrap;
        padding: 8px 14px;
        font-size: 13px;
    }

    .card {
        padding: 16px;
    }

    .modal-box {
        padding: 24px;
        margin: 16px;
    }

    /* Better table on mobile */
    .inline-flex.gap-8,
    td .inline-flex {
        flex-wrap: wrap;
    }
}

@media (max-width: 1024px) and (min-width: 769px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}