/* Community Page Styles */
.community-hero {
    background: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
    color: white;
    padding: 5rem 5% 3rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.community-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.08) 0%, transparent 50%);
}

.community-hero .container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.community-hero h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.community-hero p {
    font-size: 1.2rem;
    max-width: 600px;
    margin: 0 auto 2rem;
    opacity: 0.9;
}

.search-container {
    max-width: 600px;
    margin: 2rem auto 0;
}

.search-bar {
    display: flex;
    gap: 0.5rem;
}

.search-bar input {
    flex: 1;
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.search-bar button {
    padding: 1rem 1.5rem;
    background: #00b894;
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.search-bar button:hover {
    background: #00a085;
    transform: translateY(-2px);
}

/* Community Navigation */
.community-nav {
    background: white;
    padding: 1rem 5%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 70px;
    z-index: 100;
}

.community-nav .container {
    max-width: 1200px;
    margin: 0 auto;
    overflow-x: hidden;
}

.nav-tabs {
    display: flex;
    gap: 2rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.nav-tabs::-webkit-scrollbar {
    display: none;
}

.nav-tabs a {
    text-decoration: none;
    color: #636e72;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    white-space: nowrap;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.nav-tabs a:hover {
    color: #6c5ce7;
    background: rgba(108, 92, 231, 0.05);
}

.nav-tabs a.active {
    color: #6c5ce7;
    background: rgba(108, 92, 231, 0.1);
    font-weight: 600;
}

/* Community Content */
.community-content {
    padding: 3rem 5%;
    background: #f8f9fa;
    overflow-x: hidden;
}

.community-content .container {
    max-width: 1200px;
    margin: 0 auto;
    overflow-x: hidden;
}

.content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

/* Groups Section */
.groups-section {
    margin-bottom: 3rem;
    overflow-x: hidden;
}

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

.section-header h2 {
    font-size: 1.8rem;
    color: #2d3436;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

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

.btn-primary {
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(108, 92, 231, 0.3);
}

.btn-secondary {
    background: transparent;
    border: 2px solid #6c5ce7;
    color: #6c5ce7;
}

.btn-secondary:hover {
    background: rgba(108, 92, 231, 0.05);
}

/* Groups Grid - FIXED FOR MOBILE */
.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.group-card {
    background: white;
    border-radius: 12px;
    overflow: visible; /* Changed from hidden to visible */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    position: relative;
    min-height: 280px; /* Ensure minimum height for icon visibility */
}

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

.group-banner {
    height: 120px;
    background: linear-gradient(135deg, #74b9ff, #0984e3);
    position: relative;
}

.group-banner.chemistry {
    background: linear-gradient(135deg, #00b894, #00a085);
}

.group-banner.physics {
    background: linear-gradient(135deg, #fd79a8, #e84393);
}

.group-banner.math {
    background: linear-gradient(135deg, #fdcb6e, #f39c12);
}

.group-banner.biology {
    background: linear-gradient(135deg, #a29bfe, #6c5ce7);
}

/* FIXED: Group icon positioning */
.group-icon {
    position: absolute;
    bottom: -25px;
    left: 20px;
    width: 60px;
    height: 60px;
    background: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    z-index: 2; /* Ensure icon is above content */
}

.group-icon i {
    font-size: 1.5rem;
    color: #6c5ce7;
}

.group-content {
    padding: 2rem 1.5rem 1.5rem;
    position: relative;
    z-index: 1;
}

.group-header {
    margin-bottom: 1rem;
}

.group-category {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    background: rgba(108, 92, 231, 0.1);
    color: #6c5ce7;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.group-title {
    font-size: 1.2rem;
    color: #2d3436;
    margin: 0.5rem 0;
    font-weight: 600;
    padding-left: 70px; /* Make space for the icon */
    min-height: 60px; /* Ensure title doesn't overlap icon */
    display: flex;
    align-items: center;
}

.group-description {
    color: #636e72;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
    clear: both; /* Clear float from icon */
}

.group-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid #eee;
    flex-wrap: wrap;
    gap: 1rem;
}

.members-count {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #636e72;
    font-size: 0.9rem;
}

.members-count i {
    color: #6c5ce7;
}

.join-btn {
    padding: 0.5rem 1rem;
    background: #6c5ce7;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.join-btn:hover {
    background: #5b4bd8;
    transform: translateY(-2px);
}

.join-btn.joined {
    background: #00b894;
}

/* Discussions Section */
.discussions-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    overflow-x: hidden;
}

.discussion-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.5rem 1rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 20px;
    color: #636e72;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.filter-btn:hover,
.filter-btn.active {
    background: #6c5ce7;
    color: white;
    border-color: #6c5ce7;
}

.discussion-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.discussion-item {
    padding: 1.5rem;
    border-radius: 10px;
    background: #f8f9fa;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
    cursor: pointer;
    overflow: hidden;
}

.discussion-item:hover {
    background: white;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    border-left-color: #6c5ce7;
}

.discussion-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.8rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.discussion-title {
    font-size: 1.1rem;
    color: #2d3436;
    font-weight: 500;
    margin: 0;
}

.discussion-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tag {
    padding: 0.2rem 0.6rem;
    background: rgba(108, 92, 231, 0.1);
    color: #6c5ce7;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.tag.urgent {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

.tag.popular {
    background: rgba(46, 204, 113, 0.1);
    color: #2ecc71;
}

.discussion-meta {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    color: #636e72;
    font-size: 0.85rem;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
}

.meta-item i {
    font-size: 0.9rem;
}

/* Sidebar */
.community-sidebar {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.sidebar-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.sidebar-card h3 {
    font-size: 1.2rem;
    color: #2d3436;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-card h3 i {
    color: #6c5ce7;
}

/* Active Members */
.active-members {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.member-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.member-item:hover {
    background: #f8f9fa;
}

.member-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    flex-shrink: 0;
}

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

.member-info h4 {
    margin: 0;
    font-size: 0.95rem;
    color: #2d3436;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.member-info p {
    margin: 0.2rem 0 0;
    font-size: 0.8rem;
    color: #636e72;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.member-status {
    margin-left: auto;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #00b894;
    flex-shrink: 0;
}

/* Upcoming Events */
.upcoming-events {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.event-item {
    padding: 1rem;
    border-radius: 8px;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.event-item:hover {
    background: white;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.event-date {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.8rem;
}

.event-day {
    background: #6c5ce7;
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
}

.event-month {
    color: #636e72;
    font-size: 0.9rem;
}

.event-title {
    font-size: 0.95rem;
    color: #2d3436;
    margin: 0.3rem 0;
    font-weight: 500;
}

.event-meta {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 0.8rem;
    color: #636e72;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

/* Quick Stats */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.stat-item {
    text-align: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: #6c5ce7;
    margin-bottom: 0.3rem;
}

.stat-label {
    font-size: 0.8rem;
    color: #636e72;
}

/* Popular Topics */
.popular-topics {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.topic-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.topic-item:hover {
    background: #f8f9fa;
}

.topic-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(108, 92, 231, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.topic-icon i {
    color: #6c5ce7;
}

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

.topic-info h4 {
    margin: 0;
    font-size: 0.9rem;
    color: #2d3436;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topic-info p {
    margin: 0.2rem 0 0;
    font-size: 0.8rem;
    color: #636e72;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.event-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

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

.event-card-header {
    padding: 1.5rem;
    color: white;
}

.event-category {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.event-card-title {
    font-size: 1.2rem;
    margin: 0;
    font-weight: 600;
}

.event-card-body {
    padding: 1.5rem;
}

.event-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.event-info .info-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #636e72;
}

.event-info .info-item i {
    color: #6c5ce7;
}

.event-description {
    color: #636e72;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

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

.event-actions .btn {
    flex: 1;
}

.event-actions .btn-primary.registered {
    background: #00b894;
    cursor: not-allowed;
}

/* Event Creation Modal Styles */
#createEventModal .modal {
    max-width: 700px;
}

#createEventModal .modal-body {
    padding: 2rem;
    max-height: 70vh;
    overflow-y: auto;
}

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

#createEventModal label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #2d3436;
    font-size: 0.95rem;
}

#createEventModal input,
#createEventModal select,
#createEventModal textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    color: #2d3436;
    background-color: #f8f9fa;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
    box-sizing: border-box;
}

#createEventModal input:focus,
#createEventModal select:focus,
#createEventModal textarea:focus {
    outline: none;
    border-color: #6c5ce7;
    background-color: white;
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

#createEventModal input[type="date"],
#createEventModal input[type="time"] {
    padding: 0.7rem 1rem;
}

#createEventModal textarea {
    resize: vertical;
    min-height: 100px;
}

/* DateTime Group */
.datetime-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.datetime-item {
    display: flex;
    flex-direction: column;
}

.datetime-item label {
    margin-bottom: 0.5rem;
}

/* Event Type Styling */
.event-type-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
    margin-top: 0.5rem;
}

.event-type-option {
    position: relative;
}

.event-type-option input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.event-type-option label {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.2rem 0.5rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    height: 100%;
    box-sizing: border-box;
}

.event-type-option label i {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: #636e72;
}

.event-type-option label span {
    font-size: 0.9rem;
    font-weight: 500;
}

.event-type-option input[type="radio"]:checked + label {
    border-color: #6c5ce7;
    background-color: rgba(108, 92, 231, 0.05);
}

.event-type-option input[type="radio"]:checked + label i,
.event-type-option input[type="radio"]:checked + label span {
    color: #6c5ce7;
}

.event-type-option:hover label {
    border-color: #a29bfe;
}

/* Event Type Colors */
.event-type-option[data-type="webinar"] label i { color: #6c5ce7; }
.event-type-option[data-type="qna"] label i { color: #00b894; }
.event-type-option[data-type="workshop"] label i { color: #fd79a8; }
.event-type-option[data-type="studygroup"] label i { color: #fdcb6e; }

.event-type-option input[type="radio"]:checked + label[data-type="webinar"] {
    border-color: #6c5ce7;
    background-color: rgba(108, 92, 231, 0.05);
}

.event-type-option input[type="radio"]:checked + label[data-type="qna"] {
    border-color: #00b894;
    background-color: rgba(0, 184, 148, 0.05);
}

.event-type-option input[type="radio"]:checked + label[data-type="workshop"] {
    border-color: #fd79a8;
    background-color: rgba(253, 121, 168, 0.05);
}

.event-type-option input[type="radio"]:checked + label[data-type="studygroup"] {
    border-color: #fdcb6e;
    background-color: rgba(253, 203, 110, 0.05);
}

/* Form Layout */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Form Notice */
.event-form-notice {
    background-color: rgba(108, 92, 231, 0.05);
    border-left: 4px solid #6c5ce7;
    padding: 1rem;
    border-radius: 4px;
    display: flex;
    gap: 1rem;
    margin: 1.5rem 0;
}

.event-form-notice i {
    color: #6c5ce7;
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-top: 0.2rem;
}

.event-form-notice p {
    margin: 0;
    font-size: 0.9rem;
    color: #636e72;
    line-height: 1.5;
}

/* Event Preview Section */
.event-preview-section {
    background-color: #f8f9fa;
    border-radius: 12px;
    padding: 2rem;
    margin-top: 2rem;
}

.event-preview-section h4 {
    font-size: 1.2rem;
    color: #2d3436;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.event-preview-section h4 i {
    color: #6c5ce7;
}

.event-preview-card {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

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

.preview-date {
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: white;
    padding: 0.8rem;
    border-radius: 8px;
    text-align: center;
    min-width: 60px;
    flex-shrink: 0;
}

.preview-date .day {
    font-size: 1.5rem;
    font-weight: 700;
    display: block;
}

.preview-date .month {
    font-size: 0.9rem;
    font-weight: 500;
    display: block;
}

.preview-title {
    flex: 1;
    min-width: 0;
}

.preview-title h5 {
    font-size: 1.1rem;
    color: #2d3436;
    margin: 0 0 0.3rem 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-type {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    background: rgba(108, 92, 231, 0.1);
    color: #6c5ce7;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.preview-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.preview-detail {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.preview-detail i {
    color: #6c5ce7;
    font-size: 1rem;
    flex-shrink: 0;
}

.preview-detail div {
    flex: 1;
    min-width: 0;
}

.preview-detail h6 {
    font-size: 0.8rem;
    color: #636e72;
    margin-bottom: 0.2rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-detail p {
    font-size: 0.95rem;
    color: #2d3436;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-description {
    color: #636e72;
    font-size: 0.9rem;
    line-height: 1.6;
    overflow-wrap: break-word;
}

/* Login Required Modal */
#loginRequiredModal .modal-body {
    text-align: center;
    padding: 3rem 2rem;
}

#loginRequiredModal .modal-icon {
    font-size: 4rem;
    color: #6c5ce7;
    margin-bottom: 1.5rem;
}

#loginRequiredModal h4 {
    font-size: 1.5rem;
    color: #2d3436;
    margin-bottom: 1rem;
}

#loginRequiredModal p {
    color: #636e72;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.login-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 2rem;
}

.login-btn {
    padding: 1rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    border: none;
    font-size: 1rem;
    text-decoration: none;
    box-sizing: border-box;
}

.login-btn.primary {
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: white;
}

.login-btn.secondary {
    background-color: transparent;
    border: 2px solid #6c5ce7;
    color: #6c5ce7;
}

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

/* Discussion Detail Modal */
#discussionDetailModal .modal-body {
    padding: 2rem;
}

.discussion-detail h4 {
    font-size: 1.5rem;
    color: #2d3436;
    margin-bottom: 1rem;
}

.discussion-detail .discussion-meta {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    color: #636e72;
    font-size: 0.9rem;
    flex-wrap: wrap;
}

.discussion-detail .discussion-content {
    margin-bottom: 2rem;
}

.discussion-detail .discussion-content p {
    color: #2d3436;
    line-height: 1.6;
}

.discussion-replies h5 {
    font-size: 1.2rem;
    color: #2d3436;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.reply-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.reply-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    border-left: 3px solid #6c5ce7;
}

.reply-author {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.reply-author strong {
    color: #2d3436;
}

.reply-author span {
    color: #636e72;
    font-size: 0.85rem;
}

.reply-item p {
    color: #2d3436;
    margin: 0;
    line-height: 1.5;
}

.reply-form {
    margin-top: 1.5rem;
}

.reply-form textarea {
    width: 100%;
    padding: 1rem;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
    resize: vertical;
    min-height: 80px;
    margin-bottom: 1rem;
    box-sizing: border-box;
}

/* Event Details Modal */
#eventDetailsModal .event-details-content {
    padding: 1rem 0;
}

.event-detail-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e9ecef;
}

.event-detail-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.event-detail-section h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #2d3436;
    margin-bottom: 0.8rem;
}

.event-detail-section h4 i {
    color: #6c5ce7;
}

.event-detail-section p,
.event-detail-section li {
    color: #636e72;
    line-height: 1.6;
}

.event-detail-section ul {
    padding-left: 1.5rem;
    margin: 0;
}

.event-detail-section li {
    margin-bottom: 0.5rem;
}

/* Registration Steps Modal */
#registrationModal .registration-steps {
    margin: 1.5rem 0;
}

.registration-steps .step {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.registration-steps .step:last-child {
    margin-bottom: 0;
}

.registration-steps .step-number {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
}

.registration-steps .step-content h4 {
    margin: 0 0 0.3rem 0;
    color: #2d3436;
    font-size: 0.95rem;
}

.registration-steps .step-content p {
    margin: 0;
    color: #636e72;
    font-size: 0.85rem;
}

/* Calendar Modal Styles */
.calendar-view {
    padding: 1rem 0;
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.calendar-nav {
    background: none;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #636e72;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.calendar-nav:hover {
    border-color: #6c5ce7;
    color: #6c5ce7;
}

#currentMonth {
    margin: 0;
    color: #2d3436;
    font-size: 1.2rem;
    text-align: center;
    flex: 1;
}

.calendar-grid {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #f8f9fa;
    padding: 1rem 0;
    text-align: center;
    font-weight: 600;
    color: #636e72;
    border-bottom: 1px solid #e9ecef;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #e9ecef;
}

.calendar-day {
    background: white;
    min-height: 60px;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    overflow: hidden;
}

.day-number {
    font-weight: 600;
    color: #2d3436;
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
}

.day-event {
    background: rgba(108, 92, 231, 0.1);
    color: #6c5ce7;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.day-event.webinar {
    background: rgba(0, 184, 148, 0.1);
    color: #00b894;
}

.day-event.qna {
    background: rgba(253, 121, 168, 0.1);
    color: #fd79a8;
}

.calendar-events {
    margin-top: 2rem;
}

.calendar-events h4 {
    color: #2d3436;
    margin-bottom: 1rem;
}

.event-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.event-list-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #6c5ce7;
    flex-wrap: wrap;
}

.event-list-item.webinar {
    border-left-color: #00b894;
}

.event-list-item.qna {
    border-left-color: #fd79a8;
}

.event-date-badge {
    background: #6c5ce7;
    color: white;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    min-width: 60px;
    text-align: center;
    flex-shrink: 0;
}

.event-details {
    flex: 1;
    min-width: 0;
}

.event-details h5 {
    margin: 0 0 0.2rem 0;
    color: #2d3436;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.event-details p {
    margin: 0;
    color: #636e72;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Notification Animation */
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* Modal Base Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
    box-sizing: border-box;
}

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

.modal {
    background-color: white;
    border-radius: 15px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
    box-sizing: border-box;
}

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

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

.modal-header h3 {
    flex: 1;
    font-size: 1.8rem;
    color: #2d3436;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.8rem;
    color: #636e72;
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
    flex-shrink: 0;
}

.modal-body {
    padding: 2rem;
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    padding: 1.5rem 2rem;
    border-top: 1px solid #e9ecef;
}

.modal-btn {
    flex: 1;
    padding: 1rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    border: none;
    font-size: 1rem;
    box-sizing: border-box;
}

.modal-btn.primary {
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: white;
}

.modal-btn.secondary {
    background-color: transparent;
    border: 2px solid #6c5ce7;
    color: #6c5ce7;
}

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

.modal-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ============= RESPONSIVE DESIGN ============= */

@media (max-width: 1200px) {
    .content-grid {
        gap: 1.5rem;
    }
    
    .groups-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 992px) {
    .content-grid {
        grid-template-columns: 1fr;
    }

    .community-hero h1 {
        font-size: 2.5rem;
    }

    .groups-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }

    .events-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
    
    .community-sidebar {
        width: 100%;
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    /* Mobile-specific fixes */
    body {
        overflow-x: hidden;
    }
    
    .community-hero {
        padding: 4rem 5% 2rem;
    }
    
    .community-hero h1 {
        font-size: 2rem;
        line-height: 1.2;
    }
    
    .community-hero p {
        font-size: 1rem;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .section-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .section-actions .btn {
        flex: 1;
        min-width: 140px;
    }

    .nav-tabs {
        gap: 0.5rem;
        padding: 0 5px 0.5rem;
    }

    .nav-tabs a {
        padding: 0.5rem;
        font-size: 0.9rem;
    }
    
    /* FIXED: Groups grid for mobile - icon stays visible */
    .groups-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem;
        margin: 0;
    }
    
    .group-card {
        width: 100%;
        margin: 0 auto;
        box-sizing: border-box;
        overflow: visible; /* Ensure icon is visible */
    }
    
    /* Ensure group icon is properly positioned on mobile */
    .group-icon {
        position: absolute;
        bottom: -25px;
        left: 20px;
        width: 60px;
        height: 60px;
        z-index: 10; /* Increased z-index */
        background: white;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    }
    
    .group-content {
        padding: 2.5rem 1rem 1.5rem; /* Increased top padding for icon */
        position: relative;
        z-index: 1;
    }
    
    .group-title {
        padding-left: 70px; /* Keep space for icon on mobile */
        min-height: 60px;
        display: flex;
        align-items: center;
        font-size: 1.1rem;
    }
    
    .group-stats {
        flex-direction: row; /* Keep row layout on mobile */
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        margin-top: 1rem;
    }
    
    .join-btn {
        width: auto; /* Don't make button full width */
        padding: 0.5rem 1.2rem;
    }
    
    /* Fix discussion items */
    .discussion-item {
        padding: 1rem;
        margin: 0;
        width: 100%;
        box-sizing: border-box;
    }
    
    .discussion-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .discussion-tags {
        width: 100%;
        justify-content: flex-start;
    }
    
    .discussion-meta {
        justify-content: space-between;
        gap: 0.5rem;
    }
    
    .meta-item {
        font-size: 0.8rem;
    }
    
    /* Fix discussion filters */
    .discussion-filters {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }
    
    .filter-btn {
        padding: 0.5rem;
        font-size: 0.8rem;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* Fix form layouts */
    .form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .datetime-group {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .event-type-options {
        grid-template-columns: 1fr;
    }
    
    /* Fix event grid */
    .events-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }
    
    .event-card {
        width: 100%;
        margin: 0 auto;
    }
    
    .event-info {
        grid-template-columns: 1fr;
    }
    
    .event-actions {
        flex-direction: column;
    }
    
    /* Fix search bar */
    .search-bar {
        flex-direction: column;
    }
    
    .search-bar input {
        width: 100%;
    }
    
    .search-bar button {
        width: 100%;
    }
    
    /* Fix sidebar */
    .sidebar-card {
        padding: 1.2rem;
    }
    
    .quick-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Fix modals */
    .modal {
        max-height: 95vh;
        margin: 0;
    }
    
    .modal-header {
        padding: 1.5rem 1.5rem 1rem;
    }
    
    .modal-body {
        padding: 1.5rem;
    }
    
    .modal-buttons {
        flex-direction: column;
    }
    
    .modal-btn {
        width: 100%;
    }
}

@media (max-width: 576px) {
    /* Extra small devices */
    .community-hero h1 {
        font-size: 1.8rem;
    }
    
    .community-hero p {
        font-size: 0.95rem;
    }
    
    /* Ensure group icon is visible on very small screens */
    .group-icon {
        left: 15px;
        width: 50px;
        height: 50px;
        bottom: -20px;
    }
    
    .group-icon i {
        font-size: 1.3rem;
    }
    
    .group-title {
        padding-left: 60px; /* Adjusted for smaller icon */
        min-height: 50px;
        font-size: 1rem;
    }
    
    .group-content {
        padding: 2rem 0.8rem 1rem;
    }
    
    .group-stats {
        flex-direction: column; /* Stack on very small screens */
        align-items: stretch;
    }
    
    .join-btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Fix discussion filters for very small screens */
    .discussion-filters {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Fix sidebar items */
    .active-members {
        gap: 0.8rem;
    }
    
    .member-item {
        padding: 0.6rem;
    }
    
    .upcoming-events {
        gap: 0.8rem;
    }
    
    .event-item {
        padding: 0.8rem;
    }
    
    /* Fix quick stats */
    .quick-stats {
        grid-template-columns: 1fr;
    }
    
    .stat-item {
        padding: 0.8rem;
    }
    
    /* Fix modal */
    .modal-header h3 {
        font-size: 1.5rem;
    }
    
    .modal {
        padding: 0;
    }
}

@media (max-width: 400px) {
    /* Extra fixes for very small screens */
    .nav-tabs a {
        font-size: 0.8rem;
        padding: 0.4rem 0.6rem;
    }
    
    .btn {
        padding: 0.7rem 1rem;
        font-size: 0.9rem;
    }
    
    .discussion-filters {
        grid-template-columns: 1fr;
    }
    
    .filter-btn {
        width: 100%;
    }
    
    .community-nav {
        padding: 0.5rem 3%;
    }
    
    .community-content {
        padding: 2rem 3%;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .join-btn,
    .filter-btn,
    .btn,
    .modal-btn,
    .login-btn {
        min-height: 44px; /* Minimum touch target size */
    }
    
    .meta-item {
        padding: 4px 0; /* Add touch padding */
    }
    
    .discussion-item {
        padding: 1rem;
    }
    
    /* Increase tap targets for mobile */
    .group-card,
    .event-card {
        margin-bottom: 8px;
    }
}