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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8fafc;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #4f46e5;
}

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

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

.nav {
    display: flex;
    gap: 2rem;
}

.nav-link {
    text-decoration: none;
    color: #64748b;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link:hover,
.nav-link.active {
    color: #4f46e5;
    background-color: #f1f5f9;
}

.tutorial-link {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white !important;
    font-weight: 600;
}

.external-link {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: white !important;
    font-weight: 600;
}

.external-link:hover {
    background: linear-gradient(135deg, #047857 0%, #065f46 100%);
    color: white !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

.tutorial-link:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    transform: translateY(-1px);
}

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

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #64748b;
    position: relative;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: background-color 0.2s;
}

.user-profile:hover {
    background-color: #f1f5f9;
}

.user-profile i {
    font-size: 1.5rem;
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    display: none;
    z-index: 1000;
    margin-top: 0.5rem;
}

.user-dropdown.show {
    display: block;
}

.dropdown-item {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid #f1f5f9;
}

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

.dropdown-item:hover {
    background-color: #f8fafc;
}

.dropdown-item.danger {
    color: #ef4444;
}

.dropdown-item.danger:hover {
    background-color: #fef2f2;
}

.dropdown-item i {
    width: 1rem;
    text-align: center;
}

/* Team Management Styles */
.team-detail-tabs {
    display: flex;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 1.5rem;
}

/* Teams Selector */
.teams-selector {
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 1rem;
    background: #f8fafc;
}

.teams-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
}

.team-checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: 0.25rem;
    transition: background-color 0.2s;
}

.team-checkbox-item:hover {
    background: #e2e8f0;
}

.team-checkbox-item input[type="checkbox"] {
    margin: 0;
}

.team-checkbox-info {
    flex: 1;
}

.team-checkbox-name {
    font-weight: 500;
    color: #2d3748;
}

.team-checkbox-desc {
    font-size: 0.875rem;
    color: #718096;
    margin-top: 0.25rem;
}

.form-help {
    font-size: 0.875rem;
    color: #718096;
    margin-top: 0.75rem;
    margin-bottom: 0;
    font-style: italic;
}

.member-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: center;
}

.member-controls input {
    flex: 1;
}

.member-controls select {
    min-width: 120px;
}

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

.member-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
}

.member-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.member-avatar {
    width: 2.5rem;
    height: 2.5rem;
    background: #4f46e5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.member-details h4 {
    margin: 0;
    color: #1e293b;
    font-size: 1rem;
}

.member-details p {
    margin: 0;
    color: #64748b;
    font-size: 0.875rem;
}

.member-role {
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.member-role.admin {
    background: #fef3c7;
    color: #92400e;
}

.member-role.member {
    background: #dbeafe;
    color: #1e40af;
}

.member-actions {
    display: flex;
    gap: 0.5rem;
}

.repo-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: center;
}

.repo-controls select {
    flex: 1;
}

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

.team-repo-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
}

.repo-info h4 {
    margin: 0;
    color: #1e293b;
    font-size: 1rem;
}

.repo-info p {
    margin: 0;
    color: #64748b;
    font-size: 0.875rem;
}

.repo-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: #64748b;
}

/* User Settings Styles */
.user-settings h4 {
    color: #1e293b;
    margin: 2rem 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.user-settings h4:first-of-type {
    margin-top: 0;
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary {
    background: #4f46e5;
    color: white;
}

.btn-primary:hover {
    background: #4338ca;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #f1f5f9;
    color: #64748b;
}

.btn-secondary:hover {
    background: #e2e8f0;
}

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

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

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

/* Main Content */
.main {
    padding: 2rem 0;
}

.section {
    display: none;
}

.section.active {
    display: block;
}

.section-header {
    margin-bottom: 2rem;
    text-align: center;
}

.section-header h2 {
    font-size: 2rem;
    color: #1e293b;
    margin-bottom: 0.5rem;
}

.section-header p {
    color: #64748b;
    font-size: 1.1rem;
}

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

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card i {
    font-size: 2rem;
    color: #4f46e5;
}

.stat-info h3 {
    font-size: 2rem;
    color: #1e293b;
    margin-bottom: 0.25rem;
}

.stat-info p {
    color: #64748b;
    font-weight: 500;
}

/* Activity List */
.recent-activity {
    background: white;
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.recent-activity h3 {
    margin-bottom: 1rem;
    color: #1e293b;
}

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

.activity-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 0.5rem;
}

.activity-item i {
    color: #4f46e5;
}

.activity-item p {
    flex: 1;
    margin: 0;
}

.activity-time {
    color: #64748b;
    font-size: 0.875rem;
}

/* Repository Grid */
.repository-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.repo-card {
    background: white;
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.repo-card:hover {
    transform: translateY(-2px);
}

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

.repo-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.5rem;
}

.repo-description {
    color: #64748b;
    margin-bottom: 1rem;
}

.repo-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: #64748b;
}

.repo-actions {
    display: flex;
    gap: 0.5rem;
}

.repo-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.stat {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: #64748b;
}

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

.team-card {
    background: white;
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.team-card:hover {
    transform: translateY(-2px);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    backdrop-filter: blur(4px);
}

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

.modal-content {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal.large .modal-content {
    max-width: 800px;
}

.modal-header {
    padding: 1.5rem 1.5rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #64748b;
    padding: 0.25rem;
}

.modal-close:hover {
    color: #1e293b;
}

.modal-body {
    padding: 1.5rem;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

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

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

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

.form-control {
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

/* Tabs */
.repo-detail-tabs {
    display: flex;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 1.5rem;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    background: none;
    cursor: pointer;
    color: #64748b;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab-btn.active {
    color: #4f46e5;
    border-bottom-color: #4f46e5;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Version Controls */
.version-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: center;
}

.version-controls select {
    min-width: 150px;
}

/* Versions List */
.versions-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.version-item {
    background: #f8fafc;
    padding: 1rem;
    border-radius: 0.5rem;
    border-left: 4px solid #4f46e5;
}

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

.version-id {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.875rem;
    background: #e2e8f0;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

.version-message {
    font-weight: 500;
    color: #1e293b;
}

.version-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: #64748b;
}

.version-actions {
    display: flex;
    gap: 0.5rem;
}

/* Performance Chart */
.performance-metrics {
    padding: 1rem;
}

/* Collaborators */
.collaborator-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.collaborator-controls input {
    flex: 1;
}

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

.collaborator-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 0.5rem;
}

/* Conflicts */
.conflicts-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.conflict-item {
    background: #fef2f2;
    border: 1px solid #fecaca;
    padding: 1rem;
    border-radius: 0.5rem;
}

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

.conflict-files {
    margin-bottom: 1rem;
}

.conflict-diff {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 1rem;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.diff-line {
    padding: 0.25rem 0;
}

.diff-add {
    background: #dcfce7;
    color: #166534;
}

.diff-remove {
    background: #fee2e2;
    color: #991b1b;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header .container {
        flex-direction: column;
        gap: 1rem;
    }

    .nav {
        flex-wrap: wrap;
        justify-content: center;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .repository-grid {
        grid-template-columns: 1fr;
    }

    .teams-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        margin: 1rem;
    }

    .version-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .collaborator-controls {
        flex-direction: column;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section.active {
    animation: fadeIn 0.3s ease-out;
}

/* Badge styles */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 0.25rem;
    text-transform: uppercase;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

/* Tag styles */
.tag {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: #f1f5f9;
    color: #475569;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    margin-right: 0.25rem;
    margin-bottom: 0.25rem;
}

/* Loading spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #4f46e5;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #64748b;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #cbd5e1;
}

.empty-state h3 {
    margin-bottom: 0.5rem;
    color: #475569;
}

.empty-state p {
    margin-bottom: 1.5rem;
}

/* Dark Mode Support */
.dark-mode {
    --bg-color: #1a1a1a;
    --surface-color: #2d2d2d;
    --text-color: #ffffff;
    --text-muted: #cccccc;
    --border-color: #404040;
    --primary-color: #4f9eff;
    --danger-color: #ff6b6b;
    --success-color: #51cf66;
    --warning-color: #ffa726;
}

.dark-mode body {
    background: var(--bg-color);
    color: var(--text-color);
}

.dark-mode .header {
    background: var(--surface-color);
    border-bottom-color: var(--border-color);
}

.dark-mode .nav-link {
    color: var(--text-muted);
}

.dark-mode .nav-link.active,
.dark-mode .nav-link:hover {
    color: var(--primary-color);
}

.dark-mode .external-link {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: white !important;
}

.dark-mode .external-link:hover {
    background: linear-gradient(135deg, #047857 0%, #065f46 100%);
    color: white !important;
}

.dark-mode .container,
.dark-mode .modal-content {
    background: var(--surface-color);
    color: var(--text-color);
}

.dark-mode .stat-card,
.dark-mode .repo-card,
.dark-mode .team-card,
.dark-mode .activity-item,
.dark-mode .member-item,
.dark-mode .team-repo-item {
    background: var(--bg-color);
    border-color: var(--border-color);
    color: var(--text-color);
}

.dark-mode .teams-selector {
    background: var(--bg-color);
    border-color: var(--border-color);
}

.dark-mode .team-checkbox-item:hover {
    background: var(--surface-color);
}

.dark-mode .team-checkbox-name {
    color: var(--text-color);
}

.dark-mode .team-checkbox-desc,
.dark-mode .form-help {
    color: var(--text-muted);
}

.dark-mode input,
.dark-mode textarea,
.dark-mode select {
    background: var(--bg-color);
    border-color: var(--border-color);
    color: var(--text-color);
}

.dark-mode input:focus,
.dark-mode textarea:focus,
.dark-mode select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(79, 158, 255, 0.2);
}

.dark-mode .user-dropdown {
    background: var(--surface-color);
    border-color: var(--border-color);
}

.dark-mode .user-dropdown a {
    color: var(--text-color);
}

.dark-mode .user-dropdown a:hover {
    background: var(--bg-color);
}

.dark-mode .modal-overlay {
    background: rgba(0, 0, 0, 0.8);
}

.dark-mode h1, .dark-mode h2, .dark-mode h3, .dark-mode h4 {
    color: var(--text-color);
}
