/* 
=================================
DigiMitro Advanced - Modern CSS
=================================
*/

/* ============ ROOT VARIABLES ============ */
:root {
    /* Primary Colors */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #8b5cf6;
    --accent: #ec4899;
    
    /* Status Colors */
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    
    /* Neutral Colors */
    --dark: #1f2937;
    --gray-900: #111827;
    --gray-800: #1f2937;
    --gray-700: #374151;
    --gray-600: #4b5563;
    --gray-500: #6b7280;
    --gray-400: #9ca3af;
    --gray-300: #d1d5db;
    --gray-200: #e5e7eb;
    --gray-100: #f3f4f6;
    --light: #f9fafb;
    --white: #ffffff;
    
    /* Gradients */
    --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%);
    --gradient-4: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    --gradient-5: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    
    /* Shadows */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 6px 12px -2px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    
    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-full: 9999px;
    
    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    
    /* Transitions */
    --transition: all 0.3s ease;
    --transition-fast: all 0.15s ease;
}

/* ============ BASE STYLES ============ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--gray-800);
    line-height: 1.6;
    font-size: 16px;
}

a {
    text-decoration: none;
    color: var(--primary);
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ============ NAVBAR ============ */
.navbar {
    background: white;
    box-shadow: var(--shadow-md);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.navbar-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.75rem;
    font-weight: 800;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo i {
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-menu {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    list-style: none;
}

.nav-link {
    text-decoration: none;
    color: var(--gray-700);
    font-weight: 500;
    padding: 0.625rem 1rem;
    border-radius: var(--radius-md);
    transition: var(--transition);
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link:hover {
    background: var(--gray-100);
    color: var(--primary);
}

.nav-link.active {
    background: var(--gradient-1);
    color: white;
}

.nav-link i {
    font-size: 1.1rem;
}

.badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--danger);
    color: white;
    border-radius: var(--radius-full);
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0 0.35rem;
    border: 2px solid white;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid var(--primary);
    cursor: pointer;
    transition: var(--transition);
}

.user-avatar:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

/* ============ BUTTONS ============ */
.btn {
    padding: 0.625rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
    font-size: 0.95rem;
}

.btn-primary {
    background: var(--gradient-1);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--gradient-2);
    color: white;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.btn-success:hover {
    background: #059669;
    transform: translateY(-2px);
}

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

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

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

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.btn-ghost {
    background: transparent;
    color: var(--gray-600);
}

.btn-ghost:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.btn-sm {
    padding: 0.375rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.875rem 2rem;
    font-size: 1.1rem;
}

.btn-block {
    width: 100%;
    display: flex;
}

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

/* ============ CONTAINER & LAYOUT ============ */
.container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

.layout-grid {
    display: grid;
    grid-template-columns: 280px 1fr 320px;
    gap: 1.5rem;
    align-items: start;
}

.layout-two-col {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.5rem;
    align-items: start;
}

.main-content {
    min-height: 400px;
}

/* ============ CARDS ============ */
.card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-body {
    padding: 0;
}

.card-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

.card-compact {
    padding: 1rem;
}

.card-gradient {
    background: var(--gradient-1);
    color: white;
}

/* ============ SIDEBAR ============ */
.sidebar {
    position: sticky;
    top: 90px;
}

.sidebar-widget {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.widget-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.widget-title i {
    color: var(--primary);
}

.widget-list {
    list-style: none;
}

.widget-list-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

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

.widget-list-item:hover {
    background: var(--gray-50);
    margin: 0 -0.5rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    border-radius: var(--radius);
}

/* ============ PROFILE CARD ============ */
.profile-card {
    text-align: center;
}

.profile-cover {
    height: 120px;
    background: var(--gradient-1);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    margin: -1.25rem -1.25rem 0;
    position: relative;
}

.profile-avatar-wrapper {
    position: relative;
    margin-top: -50px;
    margin-bottom: 1rem;
}

.profile-avatar-large {
    width: 100px;
    height: 100px;
    border-radius: var(--radius-full);
    border: 4px solid white;
    margin: 0 auto;
    box-shadow: var(--shadow-md);
}

.profile-name {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.profile-username {
    color: var(--gray-500);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

.profile-stat {
    text-align: center;
}

.profile-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.profile-stat-label {
    font-size: 0.85rem;
    color: var(--gray-500);
}

/* ============ POST/THREAD CARDS ============ */
.post-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

.post-card:hover {
    box-shadow: var(--shadow-md);
}

.post-header {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.post-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.post-author-info {
    flex: 1;
}

.post-author-name {
    font-weight: 600;
    color: var(--gray-800);
    font-size: 1rem;
}

.post-meta {
    color: var(--gray-500);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.post-content {
    margin-bottom: 1rem;
    line-height: 1.6;
    color: var(--gray-700);
}

.post-image {
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    overflow: hidden;
}

.post-image img {
    width: 100%;
    height: auto;
}

.post-actions {
    display: flex;
    gap: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

.post-action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--gray-600);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius);
    transition: var(--transition);
    font-size: 0.9rem;
}

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

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

.post-action-btn i {
    font-size: 1.1rem;
}

/* ============ DISCUSSION THREAD STYLES ============ */
.thread-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
    transition: var(--transition);
    border-left: 4px solid transparent;
}

.thread-card:hover {
    box-shadow: var(--shadow-md);
    border-left-color: var(--primary);
    transform: translateX(2px);
}

.thread-card.pinned {
    border-left-color: var(--warning);
    background: linear-gradient(to right, #fffbeb 0%, white 100%);
}

.thread-card.locked {
    opacity: 0.7;
}

.thread-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.thread-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.thread-title:hover {
    color: var(--primary);
}

.thread-badges {
    display: flex;
    gap: 0.5rem;
}

.thread-badge {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.thread-badge.pinned {
    background: var(--warning);
    color: white;
}

.thread-badge.locked {
    background: var(--gray-400);
    color: white;
}

.thread-badge.hot {
    background: var(--danger);
    color: white;
}

.thread-excerpt {
    color: var(--gray-600);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.thread-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-100);
}

.thread-author {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--gray-600);
}

.thread-stats {
    display: flex;
    gap: 1.5rem;
    font-size: 0.9rem;
    color: var(--gray-500);
}

.thread-stat {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* ============ SPACE CARDS ============ */
.space-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

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

.space-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: var(--gradient-1);
}

.space-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--gray-800);
}

.space-description {
    color: var(--gray-600);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.space-stats {
    display: flex;
    gap: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

.space-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--gray-600);
    font-size: 0.9rem;
}

.space-stat i {
    color: var(--primary);
}

/* ============ FORMS ============ */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--gray-700);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: var(--transition);
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

.form-control-lg {
    padding: 1rem 1.25rem;
    font-size: 1.1rem;
}

.form-text {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: var(--gray-500);
}

/* ============ COMMENTS ============ */
.comments-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--gray-200);
}

.comment {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.comment-body {
    flex: 1;
    background: var(--gray-50);
    padding: 1rem;
    border-radius: var(--radius-md);
}

.comment-author {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.comment-text {
    color: var(--gray-700);
    line-height: 1.5;
}

.comment-meta {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--gray-500);
}

/* ============ ALERTS ============ */
.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    border-left: 4px solid;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.alert-success {
    background: #d1fae5;
    border-color: var(--success);
    color: #065f46;
}

.alert-danger {
    background: #fee2e2;
    border-color: var(--danger);
    color: #991b1b;
}

.alert-warning {
    background: #fef3c7;
    border-color: var(--warning);
    color: #92400e;
}

.alert-info {
    background: #dbeafe;
    border-color: var(--info);
    color: #1e40af;
}

/* ============ BADGES & LABELS ============ */
.badge-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 600;
    background: var(--gray-100);
    color: var(--gray-700);
}

.badge-primary {
    background: var(--primary);
    color: white;
}

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

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

.online-indicator {
    width: 12px;
    height: 12px;
    background: var(--success);
    border-radius: var(--radius-full);
    border: 2px solid white;
    position: absolute;
    bottom: 2px;
    right: 2px;
}

/* ============ PAGINATION ============ */
.pagination {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 2rem;
}

.pagination-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--gray-200);
    background: white;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.pagination-btn:hover {
    background: var(--gray-100);
}

.pagination-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ============ LOADING & EMPTY STATES ============ */
.loading-spinner {
    border: 4px solid var(--gray-200);
    border-top: 4px solid var(--primary);
    border-radius: var(--radius-full);
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--gray-500);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    color: var(--gray-300);
}

/* ============ RESPONSIVE DESIGN ============ */
@media (max-width: 1200px) {
    .layout-grid {
        grid-template-columns: 240px 1fr 280px;
    }
}

@media (max-width: 992px) {
    .layout-grid {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        position: static;
    }
    
    .sidebar-left {
        order: 1;
    }
    
    .main-content {
        order: 2;
    }
    
    .sidebar-right {
        order: 3;
    }
}

@media (max-width: 768px) {
    .navbar-container {
        padding: 0 1rem;
    }
    
    .nav-menu {
        gap: 0.25rem;
    }
    
    .nav-link {
        padding: 0.5rem;
        font-size: 0.9rem;
    }
    
    .nav-link span {
        display: none;
    }
    
    .container {
        padding: 0 1rem;
    }
    
    .layout-two-col {
        grid-template-columns: 1fr;
    }
    
    .card {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 1.25rem;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    .post-actions {
        gap: 0.75rem;
    }
    
    .post-action-btn {
        font-size: 0.85rem;
    }
}

/* ============ UTILITIES ============ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--primary); }
.text-muted { color: var(--gray-500); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }

.mt-1 { margin-top: var(--space-2); }
.mt-2 { margin-top: var(--space-4); }
.mt-3 { margin-top: var(--space-6); }
.mb-1 { margin-bottom: var(--space-2); }
.mb-2 { margin-bottom: var(--space-4); }
.mb-3 { margin-bottom: var(--space-6); }

.d-flex { display: flex; }
.d-block { display: block; }
.d-none { display: none; }

.flex-1 { flex: 1; }
.gap-1 { gap: var(--space-2); }
.gap-2 { gap: var(--space-4); }

.rounded { border-radius: var(--radius); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

/* ============ CUSTOM SCROLLBAR ============ */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}
