/*
 * components.css
 * Desain Komponen Premium UI/UX (Healthcare Style)
 * Posyandu Cendrawasih, Kota Tasikmalaya
 */

/* 1. Header & Navigation */
.header-bar {
    background-color: var(--color-white);
    padding: 15px 20px;
    border-bottom: 1px solid var(--color-border-light);
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}

.header-title-wrapper {
    display: flex;
    flex-direction: column;
}

.header-title {
    font-size: 16px;
    font-weight: 700;
}

.header-subtitle {
    font-size: 11px;
    color: var(--color-text-muted);
}

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

.header-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-dark);
    padding: 5px;
    border-radius: 50%;
    transition: background-color 0.2s;
}

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

/* Bottom Navigation Bar */
.bottom-nav {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background-color: var(--color-white);
    border-top: 1px solid var(--color-border-light);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 500;
    box-shadow: 0 -5px 25px rgba(0,0,0,0.05);
    border-bottom-left-radius: inherit;
    border-bottom-right-radius: inherit;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-family: var(--font-primary);
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    width: 60px;
    height: 100%;
    transition: color 0.2s, transform 0.2s;
    text-decoration: none;
    gap: 4px;
}

.nav-item svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
    transition: transform 0.2s;
}

.nav-item.active {
    color: var(--color-primary);
}

.nav-item.active svg {
    transform: translateY(-2px);
    fill: var(--color-primary);
}

/* Floating Action Button (FAB) */
.fab {
    position: absolute;
    bottom: 85px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    color: var(--color-white);
    border: none;
    box-shadow: 0 6px 20px rgba(26, 188, 156, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 400;
    transition: transform 0.2s, box-shadow 0.2s;
}

.fab:active {
    transform: scale(0.95);
}

.fab svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

/* 2. Cards */
.card {
    background-color: var(--color-white);
    border-radius: var(--border-radius-md);
    padding: 20px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--color-border-light);
    margin-bottom: 15px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card-interactive:active {
    transform: scale(0.98);
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}

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

.card-title {
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 3. Forms & Inputs */
.form-group {
    margin-bottom: 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-dark);
}

.form-control {
    font-family: var(--font-primary);
    font-size: 14px;
    padding: 12px 16px;
    border-radius: var(--border-radius-sm);
    border: 1.5px solid var(--color-border-light);
    background-color: var(--color-background);
    outline: none;
    transition: border-color 0.2s, background-color 0.2s;
    width: 100%;
}

.form-control:focus {
    border-color: var(--color-primary);
    background-color: var(--color-white);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232C3E50' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px;
    padding-right: 40px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* Buttons */
.btn {
    font-family: var(--font-primary);
    font-size: 14px;
    font-weight: 600;
    padding: 12px 20px;
    border-radius: var(--border-radius-md);
    border: none;
    cursor: pointer;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s, transform 0.1s;
    width: 100%;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    color: var(--color-white);
    box-shadow: 0 4px 15px rgba(26, 188, 156, 0.2);
}

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

.btn-outline {
    background-color: transparent;
    border: 1.5px solid var(--color-primary);
    color: var(--color-primary);
}

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

.btn-sm {
    padding: 8px 12px;
    font-size: 12px;
    border-radius: var(--border-radius-sm);
}

/* 4. Badges & Indicators */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 20px;
    text-transform: capitalize;
}

.badge-success {
    background-color: var(--color-success-light);
    color: var(--color-success);
}

.badge-warning {
    background-color: var(--color-warning-light);
    color: var(--color-orange);
}

.badge-danger {
    background-color: var(--color-danger-light);
    color: var(--color-danger);
}

.badge-secondary {
    background-color: var(--color-border-light);
    color: var(--color-text-muted);
}

/* 5. Summary Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background-color: var(--color-white);
    border-radius: var(--border-radius-md);
    padding: 15px;
    border: 1px solid var(--color-border-light);
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    overflow: hidden;
}

.stat-card-title {
    font-size: 11px;
    color: var(--color-text-muted);
    font-weight: 600;
}

.stat-card-value {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 800;
}

.stat-card-icon {
    position: absolute;
    bottom: -10px;
    right: -10px;
    opacity: 0.08;
    color: var(--color-text-dark);
}

.stat-card-icon svg {
    width: 70px;
    height: 70px;
}

/* Quick Menu Grid */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    background: none;
    border: none;
}

.menu-icon {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    background-color: var(--color-white);
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--color-border-light);
    transition: transform 0.2s;
    color: var(--color-primary);
}

.menu-item:active .menu-icon {
    transform: scale(0.9);
}

.menu-label {
    font-size: 10px;
    font-weight: 600;
    text-align: center;
    color: var(--color-text-dark);
}

/* 6. List Items */
.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border-light);
}

.list-item:last-child {
    border-bottom: none;
}

.list-item-title {
    font-size: 14px;
    font-weight: 600;
}

.list-item-subtitle {
    font-size: 11px;
    color: var(--color-text-muted);
}

/* Search Bar */
.search-wrapper {
    position: relative;
    margin-bottom: 15px;
}

.search-input {
    padding-left: 42px;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    pointer-events: none;
    display: flex;
}

.search-icon svg {
    width: 18px;
    height: 18px;
}

/* 7. Toast Notification */
.toast-container {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1100;
    width: calc(100% - 40px);
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background-color: var(--color-text-dark);
    color: var(--color-white);
    padding: 12px 20px;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-medium);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    font-weight: 500;
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.3s, transform 0.3s;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-success { background-color: var(--color-success); }
.toast-danger { background-color: var(--color-danger); }
.toast-warning { background-color: var(--color-orange); }

/* 8. Loading Skeleton */
.skeleton {
    background: linear-gradient(90deg, #f2f2f2 25%, #e6e6e6 50%, #f2f2f2 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
    border-radius: 4px;
}

.skeleton-text {
    height: 12px;
    margin-bottom: 8px;
    width: 100%;
}

.skeleton-title {
    height: 18px;
    margin-bottom: 12px;
    width: 60%;
}

.skeleton-circle {
    width: 45px;
    height: 45px;
    border-radius: 50%;
}

@keyframes loading-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* 9. Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--color-text-muted);
}

.empty-state-icon {
    margin-bottom: 15px;
    color: var(--color-border);
}

.empty-state-icon svg {
    width: 60px;
    height: 60px;
}

.empty-state-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text-dark);
    margin-bottom: 5px;
}

/* 10. Detail & Timeline */
.timeline {
    position: relative;
    padding-left: 20px;
    margin-top: 15px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 5px;
    bottom: 5px;
    width: 2px;
    background-color: var(--color-border-light);
}

.timeline-item {
    position: relative;
    margin-bottom: 20px;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-badge {
    position: absolute;
    left: -20px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--color-primary);
    border: 2px solid var(--color-white);
}

.timeline-date {
    font-size: 10px;
    color: var(--color-text-muted);
    font-weight: 600;
}

.timeline-content {
    background-color: var(--color-background);
    padding: 10px 14px;
    border-radius: var(--border-radius-sm);
    margin-top: 5px;
}

/* Login Illustration Container */
.login-ill {
    width: 100%;
    height: 140px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    color: var(--color-primary);
}

.login-ill svg {
    width: 100px;
    height: 100px;
}

/* 11. Interactive ERD & Flowcharts Tab styles */
.doc-canvas {
    width: 100%;
    background-color: var(--color-white);
    border: 1px solid var(--color-border-light);
    border-radius: var(--border-radius-md);
    padding: 15px;
    overflow-x: auto;
    box-shadow: var(--shadow-soft);
}

/* ERD Style */
.erd-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    padding: 10px;
    min-width: 320px;
}

.erd-table {
    border: 1.5px solid var(--color-primary);
    border-radius: 12px;
    background-color: var(--color-white);
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
}

.erd-header {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    color: var(--color-white);
    padding: 8px 12px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
}

.erd-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 12px;
    border-bottom: 1px solid var(--color-border-light);
    font-size: 11px;
}

.erd-row:last-child {
    border-bottom: none;
}

.erd-key {
    font-weight: bold;
    color: var(--color-primary);
    font-size: 9px;
    margin-right: 4px;
}

.erd-relation-line {
    text-align: center;
    color: var(--color-text-muted);
    font-size: 16px;
    font-weight: bold;
    line-height: 1;
}

/* Flowchart Style */
.flow-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.flow-step {
    width: 85%;
    background-color: var(--color-background);
    border-left: 4px solid var(--color-primary);
    border-radius: 8px;
    padding: 10px 14px;
    text-align: left;
    box-shadow: 0 2px 6px rgba(0,0,0,0.02);
}

.flow-step-title {
    font-weight: 700;
    font-size: 12px;
}

.flow-step-desc {
    font-size: 10px;
    color: var(--color-text-muted);
    margin-top: 2px;
}

.flow-arrow {
    color: var(--color-primary);
    font-size: 16px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-5px); }
    60% { transform: translateY(-3px); }
}

/* Modal Window styles */
.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 900;
    display: none;
    justify-content: center;
    align-items: flex-end;
    animation: fadeIn 0.2s ease-out;
}

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

.modal-content {
    background-color: var(--color-white);
    width: 100%;
    border-top-left-radius: var(--border-radius-lg);
    border-top-right-radius: var(--border-radius-lg);
    padding: 24px;
    max-height: 85%;
    overflow-y: auto;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.1);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

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

.modal-close-btn {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
}

.modal-close-btn svg {
    width: 24px;
    height: 24px;
}

/* Growth Gauge Indicator bar */
.gauge-bar-wrapper {
    height: 10px;
    width: 100%;
    background-color: var(--color-border-light);
    border-radius: 5px;
    position: relative;
    margin: 15px 0 5px 0;
    overflow: hidden;
}

.gauge-bar-indicator {
    height: 100%;
    border-radius: 5px;
    transition: width 0.5s ease-out;
}

.gauge-labels {
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    color: var(--color-text-muted);
    font-weight: 600;
}
