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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #2c2c2c;
    color: #ffffff;
    overflow-x: hidden;
    padding: 15px;
    min-height: 100vh;
}

/* Arabic RTL Support */
[lang="ar"] {
    direction: rtl;
    text-align: right;
}

[lang="ar"] .language-selector {
    left: 20px;
    right: auto;
}

[lang="ar"] .github-badge {
    right: 20px;
    left: auto;
}

[lang="ar"] .input-group {
    flex-direction: row-reverse;
}

[lang="ar"] .hero-section {
    flex-direction: row-reverse;
}

[lang="ar"] .hero-stats {
    direction: ltr;
}

[lang="ar"] .stat-card {
    flex-direction: row-reverse;
}

[lang="ar"] .repo-header {
    flex-direction: row-reverse;
}

[lang="ar"] .repo-stats {
    flex-direction: row-reverse;
}

[lang="ar"] .badge-content {
    flex-direction: row-reverse;
}

.language-selector {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.language-dropdown {
    position: relative;
}

.language-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.1) 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    font-family: inherit;
    min-width: 120px;
    touch-action: manipulation;
}

.language-btn:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.15) 100%);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.language-btn.active {
    border-color: rgba(255, 255, 255, 0.4);
}

.flag-icon {
    width: 20px;
    height: 15px;
    border-radius: 2px;
    object-fit: cover;
    flex-shrink: 0;
}

.language-btn i {
    font-size: 12px;
    transition: transform 0.3s ease;
    margin-left: auto;
}

[lang="ar"] .language-btn i {
    margin-left: 0;
    margin-right: auto;
}

.language-btn.active i {
    transform: rotate(180deg);
}

.language-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: linear-gradient(135deg, rgba(50, 50, 50, 0.95) 0%, rgba(40, 40, 40, 0.95) 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 15px;
    backdrop-filter: blur(15px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    min-width: 150px;
    max-height: 300px;
    overflow-y: auto;
}

[lang="ar"] .language-menu {
    right: auto;
    left: 0;
}

.language-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.language-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    touch-action: manipulation;
}

[lang="ar"] .language-option {
    flex-direction: row-reverse;
}

.language-option:last-child {
    border-bottom: none;
}

.language-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.language-option.active {
    background: rgba(255, 107, 122, 0.2);
    color: #ff6b7a;
}

.language-option span {
    font-size: 14px;
    font-weight: 500;
}

.github-badge {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 999;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.1) 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    padding: 10px 15px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.badge-content {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ffffff;
    font-size: 12px;
    font-weight: 500;
}

.badge-content i {
    font-size: 16px;
    color: #ff6b7a;
}

.dashboard {
    display: flex;
    height: calc(100vh - 30px);
    gap: 15px;
    max-width: 100%;
}

.main-content {
    flex: 1;
    background-color: #2c2c2c;
    overflow-y: auto;
    padding: 30px;
    border-radius: 15px;
    min-width: 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.overview-content {
    max-width: 100%;
}

.hero-section {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 40px;
    margin-bottom: 30px;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 40px;
    min-height: 300px;
}

.hero-content {
    flex: 1;
}

.hero-content h1 {
    font-size: clamp(32px, 5vw, 48px);
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 15px;
    background: linear-gradient(135deg, #ff6b7a, #ff4757);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-content p {
    font-size: clamp(16px, 3vw, 20px);
    color: #b8b8b8;
    margin-bottom: 30px;
    font-weight: 400;
    line-height: 1.5;
}

.search-container {
    max-width: 500px;
}

.input-group {
    display: flex;
    gap: 15px;
    align-items: center;
}

.username-input {
    flex: 1;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    color: #ffffff;
    font-size: 16px;
    font-family: inherit;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.username-input:focus {
    outline: none;
    border-color: #ff6b7a;
    box-shadow: 0 0 20px rgba(255, 107, 122, 0.3);
}

.username-input::placeholder {
    color: #b8b8b8;
}

.analyze-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 15px 25px;
    background: linear-gradient(135deg, #ff6b7a, #ff4757);
    border: none;
    border-radius: 25px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    box-shadow: 0 4px 15px rgba(255, 107, 122, 0.3);
}

.analyze-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 122, 0.4);
}

.analyze-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.hero-image {
    flex: 0 0 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.code-animation {
    width: clamp(100px, 20vw, 150px);
    height: clamp(100px, 20vw, 150px);
    background: linear-gradient(135deg, #ff6b7a, #ff4757);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(40px, 8vw, 60px);
    color: white;
    animation: float 6s ease-in-out infinite;
    box-shadow: 0 20px 40px rgba(255, 107, 122, 0.3);
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

.stats-section, .timeline-section, .heatmap-section, .repositories-section {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    backdrop-filter: blur(10px);
}

.stats-section h3, .timeline-section h3, .heatmap-section h3, .repositories-section h3 {
    font-size: clamp(20px, 4vw, 24px);
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 25px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
    gap: 20px;
}

.stat-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 15px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.stat-card:hover {
    background: linear-gradient(135deg, rgba(255, 107, 122, 0.15) 0%, rgba(255, 71, 87, 0.08) 100%);
    border-color: rgba(255, 107, 122, 0.3);
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(255, 107, 122, 0.2);
}

.stat-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #ff6b7a, #ff4757);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 5px 15px rgba(255, 107, 122, 0.3);
}

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

.stat-info h4 {
    font-size: clamp(14px, 3vw, 16px);
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 6px;
}

.stat-number {
    font-size: clamp(18px, 4vw, 24px);
    font-weight: 700;
    color: #ff6b7a;
}

.timeline-controls {
    margin-bottom: 25px;
}

.time-period-selector {
    display: flex;
    gap: 10px;
    background: rgba(255, 255, 255, 0.1);
    padding: 5px;
    border-radius: 25px;
    width: fit-content;
}

.period-btn {
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-radius: 20px;
    color: #b8b8b8;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.period-btn.active,
.period-btn:hover {
    background: linear-gradient(135deg, #ff6b7a, #ff4757);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 122, 0.3);
}

.timeline-container {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 20px;
    overflow-x: auto;
}

.heatmap-container {
    text-align: center;
}

.heatmap-grid {
    display: inline-block;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    overflow-x: auto;
    max-width: 100%;
}

.heatmap-week {
    display: inline-flex;
    flex-direction: column;
    gap: 3px;
    margin-right: 3px;
}

[lang="ar"] .heatmap-week {
    margin-left: 3px;
    margin-right: 0;
}

.heatmap-day {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.heatmap-day[data-level="0"] {
    background-color: rgba(255, 255, 255, 0.1);
}

.heatmap-day[data-level="1"] {
    background-color: rgba(255, 107, 122, 0.3);
}

.heatmap-day[data-level="2"] {
    background-color: rgba(255, 107, 122, 0.5);
}

.heatmap-day[data-level="3"] {
    background-color: rgba(255, 107, 122, 0.7);
}

.heatmap-day[data-level="4"] {
    background-color: rgba(255, 107, 122, 1);
}

.heatmap-day:hover {
    transform: scale(1.3);
    box-shadow: 0 2px 8px rgba(255, 107, 122, 0.4);
}

.heatmap-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    font-size: 14px;
    color: #b8b8b8;
}

[lang="ar"] .heatmap-legend {
    flex-direction: row-reverse;
}

.legend-colors {
    display: flex;
    gap: 3px;
}

[lang="ar"] .legend-colors {
    flex-direction: row-reverse;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.legend-color[data-level="0"] {
    background-color: rgba(255, 255, 255, 0.1);
}

.legend-color[data-level="1"] {
    background-color: rgba(255, 107, 122, 0.3);
}

.legend-color[data-level="2"] {
    background-color: rgba(255, 107, 122, 0.5);
}

.legend-color[data-level="3"] {
    background-color: rgba(255, 107, 122, 0.7);
}

.legend-color[data-level="4"] {
    background-color: rgba(255, 107, 122, 1);
}

.repositories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap: 20px;
}

.repo-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 15px;
    padding: 20px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.repo-card:hover {
    background: linear-gradient(135deg, rgba(255, 107, 122, 0.15) 0%, rgba(255, 71, 87, 0.08) 100%);
    border-color: rgba(255, 107, 122, 0.3);
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(255, 107, 122, 0.2);
}

.repo-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.repo-icon {
    width: 24px;
    height: 24px;
    color: #ff6b7a;
}

.repo-name {
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    text-decoration: none;
    flex: 1;
}

.repo-name:hover {
    color: #ff6b7a;
}

.repo-stats {
    display: flex;
    gap: 15px;
    font-size: 14px;
    color: #b8b8b8;
}

.repo-stat {
    display: flex;
    align-items: center;
    gap: 5px;
}

.loading-section, .error-section {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 60px 30px;
    margin-bottom: 30px;
    backdrop-filter: blur(10px);
    text-align: center;
}

.loading-animation {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid #ff6b7a;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-animation p {
    font-size: 18px;
    color: #b8b8b8;
}

.error-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.error-content i {
    font-size: 48px;
    color: #ff6b7a;
}

.error-content h3 {
    font-size: 24px;
    color: #ffffff;
    margin: 0;
}

.error-content p {
    font-size: 16px;
    color: #b8b8b8;
    max-width: 500px;
    line-height: 1.6;
}

.retry-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #ff6b7a, #ff4757);
    border: none;
    border-radius: 25px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    box-shadow: 0 4px 15px rgba(255, 107, 122, 0.3);
}

.retry-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 122, 0.4);
}

@media (max-width: 768px) {
    body {
        padding: 10px;
        overflow: auto;
    }

    .language-selector {
        top: 15px;
        right: 15px;
    }

    [lang="ar"] .language-selector {
        left: 15px;
        right: auto;
    }

    .github-badge {
        top: 15px;
        left: 15px;
        padding: 8px 12px;
    }

    [lang="ar"] .github-badge {
        right: 15px;
        left: auto;
    }

    .badge-content {
        font-size: 11px;
    }

    .badge-content i {
        font-size: 14px;
    }

    .dashboard {
        flex-direction: column;
        height: auto;
        gap: 10px;
    }

    .main-content {
        padding: 20px;
        border-radius: 10px;
        overflow-y: visible;
    }

    .hero-section {
        flex-direction: column;
        text-align: center;
        gap: 25px;
        padding: 25px;
        min-height: auto;
    }

    [lang="ar"] .hero-section {
        flex-direction: column;
    }

    .input-group {
        flex-direction: column;
        gap: 15px;
    }

    [lang="ar"] .input-group {
        flex-direction: column;
    }

    .username-input {
        width: 100%;
    }

    .analyze-btn {
        align-self: stretch;
        justify-content: center;
    }

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

    .time-period-selector {
        width: 100%;
        justify-content: center;
    }

    .heatmap-grid {
        transform: scale(0.8);
        transform-origin: center;
    }

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

    .language-menu {
        max-height: 250px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 8px;
    }

    .language-selector {
        top: 10px;
        right: 10px;
    }

    [lang="ar"] .language-selector {
        left: 10px;
        right: auto;
    }

    .github-badge {
        top: 10px;
        left: 10px;
        padding: 6px 10px;
    }

    [lang="ar"] .github-badge {
        right: 10px;
        left: auto;
    }

    .main-content {
        padding: 15px;
    }

    .hero-section {
        padding: 20px 15px;
        gap: 20px;
        border-radius: 15px;
    }

    .stats-section, .timeline-section, .heatmap-section, .repositories-section {
        padding: 20px 15px;
        border-radius: 15px;
    }

    .stat-card, .repo-card {
        padding: 15px;
        border-radius: 12px;
    }

    .period-btn {
        padding: 8px 16px;
        font-size: 13px;
    }

    .heatmap-grid {
        transform: scale(0.7);
    }

    .language-menu {
        max-height: 200px;
    }
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 107, 122, 0.5);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 107, 122, 0.7);
}
