:root {
    --sidebar-width: 260px;
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --accent-green: #10b981;
    --orange: #f97316;
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

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

body {
    font-family: Inter, system-ui, -apple-system, 'Helvetica Neue', Arial;
    background: #f5f7fb;
    color: #222;
    overflow-x: hidden;
}

/* Particle background */
#particles-js {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: -1;
    opacity: 0.3;
}

.app {
    min-height: 100vh
}

.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95) !important;
}

.sidebar .logo {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: #fff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    animation: logoFloat 3s ease-in-out infinite;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

@keyframes logoFloat {

    0%,
    100% {
        transform: translateY(0px) rotate(0deg);
    }

    50% {
        transform: translateY(-10px) rotate(5deg);
    }
}

.sidebar .nav-link {
    color: #333;
    font-weight: 500;
    padding: 12px 14px;
    border-radius: 8px;
    margin: 4px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.sidebar .nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: var(--accent-blue);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.sidebar .nav-link:hover {
    transform: translateX(5px);
    background: rgba(59, 130, 246, 0.05);
}

.sidebar .nav-link:hover::before {
    transform: scaleY(1);
}

.sidebar .nav-link.active {
    background: linear-gradient(90deg, #eef2ff, #f3e8ff);
    color: var(--accent-blue);
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.2);
}

.sidebar .nav-link.active::before {
    transform: scaleY(1);
}

.sidebar-bottom {
    position: absolute;
    bottom: 16px;
    width: calc(var(--sidebar-width) - 24px)
}

.topbar {
    background: transparent
}

.search-form .form-control {
    width: 520px;
    max-width: 60vw
}

.feature-card {
    color: #fff;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.feature-card:hover::before {
    opacity: 1;
}

.feature-card .icon {
    font-size: 32px;
    opacity: 0.2;
    transition: all 0.3s ease;
}

.feature-card:hover .icon {
    transform: scale(1.2) rotate(10deg);
    opacity: 0.3;
}

.feature-card.blue {
    background: linear-gradient(135deg, var(--accent-blue), #2563eb);
    background-size: 200% 200%;
    animation: gradientShift 6s ease infinite;
}

.feature-card.purple {
    background: linear-gradient(135deg, var(--accent-purple), #7c3aed);
    background-size: 200% 200%;
    animation: gradientShift 6s ease infinite;
    animation-delay: 2s;
}

.feature-card.green {
    background: linear-gradient(135deg, var(--accent-green), #059669);
    background-size: 200% 200%;
    animation: gradientShift 6s ease infinite;
    animation-delay: 4s;
}

@keyframes gradientShift {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

.card {
    border: none;
    border-radius: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    animation: fadeInUp 0.6s ease-out;
}

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

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.assignment {
    background: #fff;
    transition: all 0.3s ease;
}

.assignment:hover {
    background: linear-gradient(135deg, #f8f9ff 0%, #fff 100%);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.progress-bar.bg-orange {
    background: var(--orange)
}

.wave {
    display: inline-block;
    animation: wave 1.6s infinite
}

@keyframes wave {
    0% {
        transform: rotate(0)
    }

    10% {
        transform: rotate(14deg)
    }

    20% {
        transform: rotate(-8deg)
    }

    30% {
        transform: rotate(14deg)
    }

    40% {
        transform: rotate(-4deg)
    }

    50% {
        transform: rotate(10deg)
    }

    60% {
        transform: rotate(0)
    }

    100% {
        transform: rotate(0)
    }
}

/* responsive */
@media (max-width: 991px) {
    .sidebar {
        position: fixed;
        left: -320px;
        top: 0;
        z-index: 1040;
        height: 100%;
        transition: left .25s;
    }

    .sidebar.show {
        left: 0
    }

    .sidebar-bottom {
        position: static
    }

    .search-form .form-control {
        width: 240px
    }
}

/* small visual tweaks */
.topbar .btn {
    border-radius: 10px;
    transition: all 0.3s ease;
}

.topbar .btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.stretched-link {
    font-weight: 600;
    transition: all 0.3s ease;
}

.stretched-link:hover {
    text-decoration: underline;
}

/* Progress bar animations */
.progress-bar {
    transition: width 1.5s ease-in-out;
    animation: progressGlow 2s ease-in-out infinite;
}

@keyframes progressGlow {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.8;
    }
}

/* Badge animations */
.badge {
    animation: pulseScale 2s ease-in-out infinite;
}

@keyframes pulseScale {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* Button ripple effect */
.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::after {
    width: 300px;
    height: 300px;
}

/* Typing animation for welcome text */
.typing-animation {
    overflow: hidden;
    border-right: 2px solid var(--accent-blue);
    white-space: nowrap;
    animation: typing 3.5s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from {
        width: 0;
    }

    to {
        width: 100%;
    }
}

@keyframes blink-caret {

    from,
    to {
        border-color: transparent;
    }

    50% {
        border-color: var(--accent-blue);
    }
}

/* Glow effect for important elements */
.glow {
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
    }

    to {
        box-shadow: 0 0 20px rgba(59, 130, 246, 0.8), 0 0 30px rgba(59, 130, 246, 0.6);
    }
}

/* Scroll reveal animation */
.scroll-reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scroll-reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Floating animation for icons */
.float {
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-20px);
    }
}

/* Shake animation for notifications */
@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Loading spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(59, 130, 246, 0.3);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Card flip effect */
.flip-card {
    perspective: 1000px;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flip-card:hover .flip-card-inner {
    transform: rotateY(180deg);
}

/* Neon glow text */
.neon-text {
    text-shadow: 0 0 10px var(--accent-blue),
        0 0 20px var(--accent-blue),
        0 0 30px var(--accent-blue),
        0 0 40px var(--accent-blue);
    animation: neonPulse 1.5s ease-in-out infinite;
}

@keyframes neonPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* ============================================
   WHATSAPP INTEGRATION STYLES
   ============================================ */
.whatsapp-btn {
    background: linear-gradient(135deg, #25D366, #128C7E) !important;
    border: none;
    color: white !important;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.3);
}

.whatsapp-btn:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 10px 25px rgba(37, 211, 102, 0.5);
    background: linear-gradient(135deg, #128C7E, #25D366) !important;
}

.whatsapp-btn i {
    font-size: 18px;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* Icon circles for study groups */
.icon-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    animation: bounceIn 0.6s ease-out;
}

@keyframes bounceIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.bg-purple {
    background: linear-gradient(135deg, var(--accent-purple), #7c3aed) !important;
}

.bg-orange {
    background: linear-gradient(135deg, var(--orange), #ea580c) !important;
}

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

/* Tablet (768px - 991px) */
@media (max-width: 991px) and (min-width: 768px) {
    .sidebar {
        width: 240px;
        min-width: 240px;
    }

    .sidebar-bottom {
        width: calc(240px - 24px);
    }

    .search-form .form-control {
        width: 300px;
    }

    .topbar {
        padding: 12px 20px !important;
    }

    main {
        padding: 20px !important;
    }

    .feature-card h5 {
        font-size: 18px;
    }

    .card-header h6,
    .card-header h5 {
        font-size: 16px;
    }
}

/* Mobile Large (576px - 767px) */
@media (max-width: 767px) {
    body {
        font-size: 14px;
    }

    .topbar {
        padding: 10px 15px !important;
        flex-wrap: wrap;
    }

    .topbar h4 {
        font-size: 18px;
    }

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

    .topbar .btn i {
        font-size: 16px;
    }

    main {
        padding: 15px !important;
    }

    h2 {
        font-size: 24px !important;
    }

    h5 {
        font-size: 18px;
    }

    /* Feature cards */
    .feature-card {
        padding: 20px !important;
    }

    .feature-card h5 {
        font-size: 16px;
    }

    .feature-card p {
        font-size: 13px;
    }

    .feature-card .icon {
        font-size: 24px;
    }

    /* Cards */
    .card {
        margin-bottom: 15px;
    }

    .card-header {
        padding: 12px 15px;
    }

    .card-body {
        padding: 15px;
    }

    /* Assignments */
    .assignment {
        padding: 15px !important;
        font-size: 14px;
    }

    /* Badges */
    .badge {
        font-size: 12px;
        padding: 5px 10px;
    }

    /* Search form */
    .search-form .form-control {
        width: 180px;
        font-size: 14px;
        padding: 8px 15px;
    }

    /* Sidebar user info */
    .sidebar-bottom .fw-bold {
        font-size: 14px;
    }

    .sidebar-bottom small {
        font-size: 12px;
    }

    /* Activity feed */
    .list-unstyled li {
        font-size: 13px;
        padding: 10px 0;
    }

    /* Row spacing */
    .row.g-3 {
        gap: 15px !important;
    }

    /* Button groups */
    .d-flex.gap-3 {
        gap: 10px !important;
    }

    /* Make buttons full width on mobile */
    .topbar .d-flex:last-child {
        width: 100%;
        margin-top: 10px;
        justify-content: space-between;
    }

    /* Stack feature cards */
    .feature-card {
        margin-bottom: 15px;
    }
}

/* Mobile Small (320px - 575px) */
@media (max-width: 575px) {
    :root {
        --sidebar-width: 280px;
    }

    body {
        font-size: 13px;
    }

    .app {
        display: block !important;
    }

    .sidebar {
        width: var(--sidebar-width);
        min-width: var(--sidebar-width);
    }

    .topbar {
        padding: 10px !important;
    }

    .topbar h4 {
        font-size: 16px;
    }

    .topbar .btn {
        padding: 6px 10px;
        font-size: 13px;
    }

    .topbar .btn-success {
        display: none;
        /* Hide "Ask Question" on very small screens */
    }

    main {
        padding: 10px !important;
    }

    h1 {
        font-size: 24px;
    }

    h2 {
        font-size: 20px !important;
    }

    h3 {
        font-size: 18px;
    }

    h5 {
        font-size: 16px;
    }

    h6 {
        font-size: 14px;
    }

    /* Logo */
    .sidebar .logo {
        width: 38px;
        height: 38px;
        font-size: 20px;
    }

    .sidebar-top h6 {
        font-size: 14px;
    }

    .sidebar-top small {
        font-size: 11px;
    }

    /* Navigation */
    .sidebar .nav-link {
        padding: 10px 12px;
        font-size: 14px;
    }

    .sidebar .nav-link i {
        font-size: 16px;
    }

    /* Feature cards */
    .feature-card {
        padding: 15px !important;
    }

    .feature-card h5 {
        font-size: 15px;
        margin-bottom: 8px !important;
    }

    .feature-card p {
        font-size: 12px;
        margin-bottom: 10px !important;
    }

    .feature-card .icon {
        font-size: 20px;
    }

    .feature-card a {
        font-size: 13px;
    }

    /* Cards */
    .card {
        border-radius: 12px;
    }

    .card-header {
        padding: 10px 12px;
        font-size: 14px;
    }

    .card-header h6 {
        font-size: 14px;
    }

    .card-body {
        padding: 12px;
    }

    /* Assignments */
    .assignment {
        padding: 12px !important;
        margin-bottom: 12px !important;
    }

    .assignment .fw-bold {
        font-size: 14px;
    }

    .assignment small {
        font-size: 12px;
    }

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

    /* Progress bars */
    .progress {
        height: 4px !important;
    }

    /* Badges */
    .badge {
        font-size: 11px;
        padding: 4px 8px;
    }

    /* Search - hide on very small screens */
    .search-form {
        display: none;
    }

    /* Buttons */
    .btn {
        font-size: 13px;
        padding: 8px 15px;
    }

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

    /* Activity items */
    .list-unstyled li {
        font-size: 12px;
        padding: 8px;
    }

    /* Images */
    img.rounded-circle {
        width: 35px !important;
        height: 35px !important;
    }

    /* Sidebar bottom */
    .sidebar-bottom {
        padding: 12px !important;
        position: static;
    }

    .sidebar-bottom .fw-bold {
        font-size: 13px;
    }

    .sidebar-bottom small {
        font-size: 11px;
    }

    /* Welcome message */
    .wave {
        font-size: 24px;
    }

    /* Scroll to top button */
    .btn[style*="position: fixed"] {
        width: 40px !important;
        height: 40px !important;
        bottom: 15px !important;
        right: 15px !important;
        font-size: 18px;
    }

    /* WhatsApp buttons */
    .whatsapp-btn {
        font-size: 13px;
        padding: 10px 15px;
    }

    .whatsapp-btn i {
        font-size: 16px;
    }

    /* Icon circles */
    .icon-circle {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    /* Study groups cards */
    .study-groups .card {
        padding: 15px !important;
    }

    /* Profile page specifics */
    .profile-header {
        padding: 40px 0 30px !important;
    }

    .profile-avatar {
        width: 90px;
        height: 90px;
        font-size: 36px;
    }

    .stats-card {
        padding: 15px;
        margin-bottom: 10px;
    }

    .stats-number {
        font-size: 24px;
    }

    .stats-label {
        font-size: 12px;
    }

    .achievement-badge {
        padding: 6px 12px;
        font-size: 12px;
        margin: 3px;
    }

    .activity-item {
        padding: 12px;
        font-size: 13px;
    }

    .activity-icon {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }

    /* Form inputs */
    .form-control,
    .form-select {
        font-size: 14px;
        padding: 10px 12px;
    }

    .form-label {
        font-size: 13px;
    }
}

/* Mobile Extra Small (less than 375px) */
@media (max-width: 374px) {
    .container-fluid {
        padding-left: 8px;
        padding-right: 8px;
    }

    .topbar {
        padding: 8px !important;
    }

    main {
        padding: 8px !important;
    }

    h2 {
        font-size: 18px !important;
    }

    .feature-card {
        padding: 12px !important;
    }

    .card-body {
        padding: 10px;
    }

    .btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .sidebar {
        width: 260px;
        min-width: 260px;
    }
}

/* Landscape mode for phones */
@media (max-height: 500px) and (orientation: landscape) {
    .sidebar {
        overflow-y: auto;
        max-height: 100vh;
    }

    .sidebar-bottom {
        position: static;
        margin-top: 20px;
    }

    .profile-header {
        padding: 30px 0 20px !important;
    }

    .profile-avatar {
        width: 70px;
        height: 70px;
        font-size: 28px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {

    .btn,
    .nav-link,
    .card {
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    .btn:hover {
        transform: none;
    }

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

    .card:hover {
        transform: none;
    }

    .nav-link:hover {
        transform: none;
    }
}

/* Print styles */
@media print {

    .sidebar,
    .topbar,
    .btn,
    #particles-js {
        display: none !important;
    }

    .app {
        display: block !important;
    }

    main {
        padding: 0 !important;
    }

    .card {
        page-break-inside: avoid;
    }
}