/* Sistem Informasi Desa - Custom Styles */

:root {
    --primary-color: #667eea;
    --primary-dark: #5a67d8;
    --secondary-color: #6c757d;
    --success-color: #48bb78;
    --danger-color: #f56565;
    --warning-color: #ed8936;
    --info-color: #4299e1;
    --dark-color: #2d3748;
    --light-bg: #f7fafc;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --card-shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--light-bg);
}

/* Main Layout */
.main-wrapper {
    display: flex;
    min-height: calc(100vh - 56px);
}

/* Sidebar */
.sidebar {
    position: sticky;
    top: 56px;
    height: calc(100vh - 56px);
    overflow-y: auto;
    background: white;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, margin-left 0.3s ease;
    z-index: 1000;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 56px;
    left: 0;
    width: 100%;
    height: calc(100vh - 56px);
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

/* Desktop: Sidebar always visible */
@media (min-width: 769px) {
    .sidebar {
        display: block !important;
    }
}

/* Mobile: Sidebar hidden by default, slides in when active */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 56px;
        transform: translateX(-100%);
        width: 280px !important;
        max-width: 85vw;
        z-index: 1000;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-wrapper {
        flex-direction: column;
    }
    
    .content-wrapper {
        width: 100%;
    }
}

/* Cards */
.card {
    border-radius: 12px;
    border: none;
    box-shadow: var(--card-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-shadow-hover);
}

.card-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border: none;
    padding: 1.25rem 1.5rem;
}

.stat-card {
    border-left: 4px solid var(--primary-color);
}

.stat-card.border-success {
    border-left-color: var(--success-color);
}

.stat-card.border-warning {
    border-left-color: var(--warning-color);
}

.stat-card.border-danger {
    border-left-color: var(--danger-color);
}

.stat-card.border-info {
    border-left-color: var(--info-color);
}

/* Buttons */
.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.5rem 1.25rem;
    transition: all 0.2s ease;
    border: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), #4c51bf);
}

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

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

.btn-warning {
    background: var(--warning-color);
    color: #2d3748;
}

/* Forms */
.form-control, .form-select {
    border-radius: 6px;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(52, 144, 220, 0.25);
}

/* Alerts */
.alert {
    border-radius: 8px;
    border: none;
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
}

/* Tables */
.table {
    border-radius: 8px;
    overflow: hidden;
}

.table thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
}

/* Navbar */
.navbar {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark)) !important;
    padding: 0.75rem 1rem;
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
}

.navbar .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    transition: color 0.2s;
}

.navbar .nav-link:hover {
    color: white !important;
}

/* Avatar */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-sm {
    width: 30px;
    height: 30px;
}

.avatar-lg {
    width: 80px;
    height: 80px;
}

/* Social Feed */
.post-card {
    border-radius: 10px;
    margin-bottom: 1rem;
}

.post-header {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
}

.post-content {
    padding: 1rem;
}

.post-actions {
    display: flex;
    gap: 1rem;
    padding: 0.5rem 1rem;
    border-top: 1px solid #e9ecef;
}

.post-action-btn {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    transition: color 0.2s;
}

.post-action-btn:hover {
    color: var(--primary-color);
}

.post-action-btn.active {
    color: var(--primary-color);
    font-weight: 600;
}

/* Comments */
.comment {
    padding: 0.75rem;
    border-left: 3px solid #e9ecef;
    margin-bottom: 0.5rem;
}

.comment.reply {
    margin-left: 2rem;
    border-left-color: #dee2e6;
}

/* Image Gallery */
.image-gallery {
    display: grid;
    gap: 0.5rem;
}

.image-gallery.single {
    grid-template-columns: 1fr;
}

.image-gallery.double {
    grid-template-columns: repeat(2, 1fr);
}

.image-gallery.multiple {
    grid-template-columns: repeat(3, 1fr);
}

.image-gallery img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
}

/* Loading Spinner */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Notification Badge */
.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    background: var(--danger-color);
    color: white;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Map Container */
.map-container {
    height: 500px;
    border-radius: 10px;
    overflow: hidden;
}

/* File Upload */
.file-upload-area {
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.file-upload-area:hover {
    border-color: var(--primary-color);
    background-color: #f8f9fa;
}

.file-upload-area.dragover {
    border-color: var(--primary-color);
    background-color: rgba(52, 144, 220, 0.1);
}

/* Content Area */
.content-wrapper {
    flex: 1;
    padding: 1.5rem;
    overflow-x: hidden;
}

/* Welcome Card */
.welcome-card {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border: none;
    color: white;
    margin-bottom: 2rem;
}

.welcome-card h4 {
    font-weight: 600;
}

/* Statistics Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-icon {
    font-size: 2.5rem;
    opacity: 0.2;
}

/* List Group */
.list-group-item {
    border: none;
    border-bottom: 1px solid #e2e8f0;
    padding: 1rem 1.25rem;
    transition: background-color 0.2s;
}

.list-group-item:hover {
    background-color: #f7fafc;
}

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

/* Responsive */
@media (max-width: 992px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .content-wrapper {
        padding: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .image-gallery.multiple {
        grid-template-columns: repeat(2, 1fr);
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

@media (max-width: 576px) {
    .navbar-brand {
        font-size: 1rem;
    }
    
    .stats-grid {
        gap: 0.75rem;
    }
}

/* PWA Install Prompt */
.pwa-install-prompt {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    display: none;
}

.pwa-install-prompt.show {
    display: block;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* Print Styles */
@media print {
    .sidebar, .navbar, .btn, .no-print {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
}
