/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

/* App container */
#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header styles */
.app-header {
    background: linear-gradient(135deg, #4285f4, #34a853);
    color: white;
    padding: 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.logo i {
    font-size: 2rem;
    margin-right: 1rem;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

/* Hamburger menu button */
.hamburger-menu {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    margin-left: auto;
}

.main-nav {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.nav-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    transition: all 0.3s ease;
    min-width: 80px;
}

.nav-btn:hover, .nav-btn.active {
    background: rgba(255,255,255,0.3);
    transform: translateY(-2px);
}

.nav-btn i {
    font-size: 1.2rem;
}

.nav-btn span {
    font-size: 0.8rem;
}

/* Main content */
.main-content {
    padding: 2rem;
    flex: 1;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h2 {
    color: #202124;
    font-size: 1.8rem;
}

.page-actions {
    display: flex;
    gap: 1rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #4285f4;
    color: white;
}

.btn-primary:hover {
    background: #3367d6;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #5f6368;
    color: white;
}

.btn-secondary:hover {
    background: #3c4043;
}

.btn-danger {
    background: #ea4335;
    color: white;
}

.btn-danger:hover {
    background: #d33b2c;
}

.btn-success {
    background: #34a853;
    color: white;
}

.btn-success:hover {
    background: #2d9247;
}

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

.card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.1);
}

.card-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.bg-blue { background: #4285f4; }
.bg-green { background: #34a853; }
.bg-purple { background: #aa00ff; }
.bg-orange { background: #fbbc04; }

.card-content h3 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: #202124;
}

.card-content p {
    color: #5f6368;
    font-size: 0.9rem;
}

.dashboard-charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.chart-container {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.chart-container.large {
    grid-column: 1 / -1;
    height: 400px;
}

/* Search and filter */
.search-filter {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.search-filter input,
.search-filter select {
    padding: 0.75rem;
    border: 1px solid #dadce0;
    border-radius: 8px;
    font-size: 1rem;
    min-width: 200px;
}

.search-filter input {
    flex: 1;
    min-width: 250px;
}

/* Table styles */
.table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    overflow-x: auto;
}

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

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: #5f6368;
    position: sticky;
    top: 0;
}

th[data-sort] {
    cursor: pointer;
    user-select: none;
}

th[data-sort]:hover {
    background: #e8eaed;
}

th i {
    margin-left: 0.5rem;
    font-size: 0.8rem;
}

/* Sticky column styles for tables */
th.sticky-column,
td.sticky-column {
    position: -webkit-sticky;
    position: sticky;
    left: 0;
    z-index: 10;
    background-color: #fff;
}

th.sticky-second-column,
td.sticky-second-column {
    position: -webkit-sticky;
    position: sticky;
    left: 150px; /* Adjust based on first column width */
    z-index: 9; /* Lower than first column to layer properly */
    background-color: #fff;
}

tbody tr:hover {
    background: #f8f9fa;
}

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

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    text-align: center;
}

.stat-card h3 {
    color: #5f6368;
    font-size: 1rem;
    margin-bottom: 1rem;
}

.stat-card p {
    font-size: 2rem;
    font-weight: 600;
    color: #202124;
}

/* Events grid */
.events-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.event-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    transition: transform 0.3s ease;
}

.event-card:hover {
    transform: translateY(-5px);
}

.event-card h3 {
    color: #202124;
    margin-bottom: 0.5rem;
}

.event-card p {
    color: #5f6368;
    margin-bottom: 1rem;
}

.event-date {
    font-weight: 600;
    color: #4285f4;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 0;
    border: none;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    color: #202124;
    font-size: 1.25rem;
}

.close {
    font-size: 1.5rem;
    cursor: pointer;
    color: #5f6368;
}

.close:hover {
    color: #202124;
}

.modal-body {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #5f6368;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #dadce0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #4285f4;
    box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.2);
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

/* Responsive design */
@media (max-width: 768px) {
    .hamburger-menu {
        display: block;
    }
    
    .main-nav {
        position: fixed;
        top: 70px;
        left: -100%;
        width: 250px;
        height: calc(100vh - 70px);
        background: linear-gradient(135deg, #4285f4, #34a853);
        flex-direction: column;
        align-items: stretch;
        transition: left 0.3s ease;
        z-index: 99;
        overflow-y: auto;
    }
    
    .main-nav.active {
        left: 0;
    }
    
    .nav-btn {
        width: 100%;
        padding: 1rem;
        justify-content: flex-start;
        border-radius: 0;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    
    .nav-btn span {
        font-size: 1rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .main-nav {
        flex-direction: column;
        align-items: center;
    }
    
    .nav-btn {
        width: 100%;
        max-width: 200px;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .dashboard-charts {
        grid-template-columns: 1fr;
    }
    
    .search-filter {
        flex-direction: column;
    }
    
    .search-filter input,
    .search-filter select {
        min-width: 100%;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .modal-content {
        margin: 10% auto;
        width: 95%;
    }
}

/* Group-specific styles */
.group-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.group-members-section,
.group-attendance-section,
.group-events-section {
    margin-bottom: 2rem;
}

.group-events-section {
    grid-column: 1 / -1; /* Span full width */
}

.group-info {
    margin-bottom: 2rem;
}

/* Responsive adjustments for group content */
@media (max-width: 768px) {
    .group-content {
        grid-template-columns: 1fr;
    }
}

/* Utility classes */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-1 { margin-top: 1rem; }
.mb-1 { margin-bottom: 1rem; }
.mt-2 { margin-top: 2rem; }
.mb-2 { margin-bottom: 2rem; }

.d-flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

.align-center {
    align-items: center;
}

/* Loading spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}