/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --ubuntu-orange: #E95420;
    --ubuntu-dark: #2C001E;
    --ubuntu-purple: #772953;
    --ubuntu-grey: #333333;
    --panel-bg: #2C2C2C;
    --panel-text: #FFFFFF;
    --window-bg: #FFFFFF;
    --window-border: #D0D0D0;
    --desktop-bg: #3A3A3A;
    --shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 8px 25px rgba(0, 0, 0, 0.4);
}

html, body {
    height: 100%;
    overflow: hidden;
    font-family: 'Ubuntu', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #4B2E39 0%, #2C1E3A 50%, #1A1A2E 100%);
    color: #333;
    position: relative;
}

/* Top Panel */
.top-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 32px;
    background: var(--panel-bg);
    color: var(--panel-text);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    z-index: 10000;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    font-size: 13px;
}

.panel-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.activities-btn {
    background: transparent;
    border: none;
    color: var(--panel-text);
    padding: 4px 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.2s;
}

.activities-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.app-menu {
    display: flex;
    align-items: center;
}

.current-app {
    font-weight: 600;
}

.panel-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.clock {
    font-size: 13px;
    font-weight: 400;
}

.panel-right {
    display: flex;
    align-items: center;
}

.system-icons {
    display: flex;
    align-items: center;
    gap: 12px;
}

.system-icons i {
    cursor: pointer;
    transition: opacity 0.2s;
}

.system-icons i:hover {
    opacity: 0.7;
}

.power-btn {
    background: transparent;
    border: none;
    color: var(--panel-text);
    cursor: pointer;
    padding: 4px 8px;
    transition: background 0.2s;
}

.power-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Desktop */
.desktop {
    position: fixed;
    top: 32px;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, 100px);
    grid-auto-rows: 100px;
    gap: 20px;
    align-content: start;
}

.desktop-icon {
    width: 80px;
    height: 90px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    padding: 10px;
    border-radius: 4px;
    transition: background 0.2s;
    user-select: none;
}

.desktop-icon:hover {
    background: rgba(255, 255, 255, 0.1);
}

.desktop-icon i {
    font-size: 48px;
    color: #FFFFFF;
}

.desktop-icon span {
    font-size: 12px;
    color: #FFFFFF;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    display: block;
    line-height: 1.2;
    min-height: 14.4px; /* 12px * 1.2 line-height */
}

/* Windows */
.window {
    position: fixed;
    background: var(--window-bg);
    border-radius: 8px 8px 0 0;
    box-shadow: var(--shadow);
    display: none;
    flex-direction: column;
    min-width: 400px;
    min-height: 300px;
    max-width: 90vw;
    max-height: calc(100vh - 100px);
    z-index: 100;
}

.window.active {
    display: flex;
    z-index: 1000;
}

.window.maximized {
    top: 32px !important;
    left: 0 !important;
    width: 100% !important;
    height: calc(100vh - 32px) !important;
    border-radius: 0;
    max-width: 100vw;
    max-height: calc(100vh - 32px);
}

.window-titlebar {
    background: linear-gradient(to bottom, #E8E8E8 0%, #D0D0D0 100%);
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    user-select: none;
    border-radius: 8px 8px 0 0;
    border-bottom: 1px solid #B0B0B0;
}

.window-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.window-controls {
    display: flex;
    gap: 8px;
}

.window-btn {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    transition: all 0.2s;
}

.minimize-btn {
    background: #F4BF4F;
}

.maximize-btn {
    background: #61C454;
}

.close-btn {
    background: #EC6A5E;
}

.window-btn i {
    opacity: 0;
    color: #333;
    transition: opacity 0.2s;
}

.window-btn:hover i {
    opacity: 1;
}

.window-btn:hover {
    filter: brightness(0.9);
}

.window-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #FFFFFF;
}

/* Window Content Styles */
.about-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    max-width: 800px;
}

.about-text h2 {
    margin-bottom: 20px;
    color: var(--ubuntu-orange);
}

.about-text p {
    margin-bottom: 15px;
    line-height: 1.6;
    color: #555;
}

.about-image {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.about-image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s;
}

.about-image img:hover {
    transform: scale(1.02);
}

.about-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.stat {
    text-align: center;
    padding: 20px;
    background: #F5F5F5;
    border-radius: 8px;
}

.stat h3 {
    font-size: 2rem;
    color: var(--ubuntu-orange);
    margin-bottom: 5px;
}

.stat p {
    color: #666;
    font-size: 0.9rem;
    margin: 0;
}

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

.skill-card {
    padding: 20px;
    background: #F8F8F8;
    border-radius: 8px;
    text-align: center;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.skill-card:hover {
    border-color: var(--ubuntu-orange);
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.skill-icon {
    font-size: 3rem;
    color: var(--ubuntu-orange);
    margin-bottom: 15px;
}

.skill-card h3 {
    font-size: 1.1rem;
    margin-bottom: 10px;
    color: #333;
}

.skill-card p {
    color: #666;
    font-size: 0.9rem;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.project-card {
    background: #F8F8F8;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s;
}

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

.project-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.project-card:hover .project-image img {
    transform: scale(1.1);
}

.project-info {
    padding: 20px;
}

.project-info h3 {
    margin-bottom: 10px;
    color: #333;
}

.project-info p {
    color: #666;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.project-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tag {
    background: var(--ubuntu-orange);
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
}

.contact-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.contact-info h2 {
    margin-bottom: 15px;
    color: var(--ubuntu-orange);
}

.contact-info p {
    color: #666;
    margin-bottom: 20px;
}

.contact-item {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.contact-item i {
    font-size: 1.5rem;
    color: var(--ubuntu-orange);
    margin-top: 5px;
}

.contact-item h3 {
    font-size: 1rem;
    margin-bottom: 5px;
    color: #333;
}

.contact-item a,
.contact-item p {
    color: #666;
    text-decoration: none;
}

.contact-item a:hover {
    color: var(--ubuntu-orange);
}

.social-links {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.social-link {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--ubuntu-orange);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s;
    text-decoration: none;
}

.social-link:hover {
    background: var(--ubuntu-purple);
    transform: translateY(-3px);
}

.contact-image {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.contact-image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s;
}

.contact-image img:hover {
    transform: scale(1.02);
}

/* Terminal Window */
.terminal-window .window-titlebar {
    background: linear-gradient(to bottom, #3C3C3C 0%, #2C2C2C 100%);
    border-bottom: 1px solid #1C1C1C;
}

.terminal-window .window-title {
    color: #FFFFFF;
}

.terminal-content {
    background: #300A24;
    color: #FFFFFF;
    font-family: 'Ubuntu Mono', 'Courier New', monospace;
    font-size: 14px;
    padding: 15px;
    overflow-y: auto;
}

.terminal-output {
    margin-bottom: 10px;
}

.terminal-line {
    margin-bottom: 5px;
    line-height: 1.5;
}

.terminal-input-line {
    display: flex;
    align-items: center;
    gap: 10px;
}

.terminal-prompt {
    color: #8AE234;
    font-weight: bold;
}

.terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #FFFFFF;
    font-family: inherit;
    font-size: 14px;
    outline: none;
}

/* Dock */
.dock {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(44, 44, 44, 0.9);
    backdrop-filter: blur(10px);
    padding: 8px 15px;
    border-radius: 12px 12px 0 0;
    display: flex;
    gap: 8px;
    align-items: center;
    z-index: 9999;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

.dock-item {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.dock-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-5px);
}

.dock-item.active::before {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: var(--ubuntu-orange);
    border-radius: 50%;
}

.dock-item i {
    font-size: 24px;
    color: #FFFFFF;
}

.dock-separator {
    width: 1px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 5px;
}

/* Activities Overview */
.activities-overview {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9998;
    display: none;
    padding: 100px 50px;
    overflow-y: auto;
}

.activities-overview.active {
    display: block;
}

.activities-search {
    max-width: 600px;
    margin: 0 auto 50px;
}

.activities-search input {
    width: 100%;
    padding: 20px;
    font-size: 24px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    outline: none;
}

.activities-search input:focus {
    border-color: var(--ubuntu-orange);
}

.activities-windows {
    max-width: 1200px;
    margin: 0 auto;
}

.activities-windows h3 {
    color: white;
    margin-bottom: 30px;
    font-size: 1.5rem;
}

.activities-window-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.activities-window-preview {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.activities-window-preview:hover {
    border-color: var(--ubuntu-orange);
    transform: scale(1.05);
}

.activities-window-preview h4 {
    color: white;
    margin-bottom: 10px;
}

.activities-window-preview p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #F0F0F0;
}

::-webkit-scrollbar-thumb {
    background: #C0C0C0;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #A0A0A0;
}

.terminal-content::-webkit-scrollbar-track {
    background: #200818;
}

.terminal-content::-webkit-scrollbar-thumb {
    background: #500A40;
}

/* Responsive Design */
@media (max-width: 768px) {
    /* Desktop area optimizations */
    .desktop {
        grid-template-columns: repeat(auto-fill, 90px);
        grid-auto-rows: 100px;
        gap: 15px;
        padding: 15px;
        padding-bottom: 80px; /* Space for dock */
        justify-items: center;
    }

    .desktop-icon {
        width: 90px;
        height: 100px;
        padding: 12px;
    }

    .desktop-icon i {
        font-size: 52px;
    }

    .desktop-icon span {
        font-size: 13px;
        line-height: 1.2;
        min-height: 15.6px; /* 13px * 1.2 line-height */
    }

    /* Window optimizations for mobile */
    .window {
        min-width: 100vw !important;
        width: 100vw !important;
        max-width: 100vw !important;
        min-height: calc(100vh - 32px) !important;
        height: calc(100vh - 32px) !important;
        max-height: calc(100vh - 32px) !important;
        top: 32px !important;
        left: 0 !important;
        border-radius: 0;
    }

    .window.active {
        position: fixed;
    }

    .window-content {
        padding: 15px;
        -webkit-overflow-scrolling: touch;
    }

    /* Dock optimizations */
    .dock {
        padding: 8px 12px;
        gap: 8px;
        border-radius: 0;
        width: 100%;
        left: 0;
        transform: none;
    }

    .dock-item {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
    }

    .dock-item i {
        font-size: 22px;
    }

    /* Hide clock on mobile to save space */
    .panel-center {
        display: none;
    }

    /* Top panel adjustments */
    .top-panel {
        padding: 0 8px;
    }

    .system-icons {
        gap: 10px;
    }

    .system-icons i {
        font-size: 14px;
    }

    /* Activities overview */
    .activities-overview {
        padding: 60px 15px;
    }

    .activities-search input {
        font-size: 18px;
        padding: 15px;
    }

    .activities-window-grid {
        grid-template-columns: 1fr;
    }

    /* Content grids */
    .skills-grid,
    .projects-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .contact-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    /* About content */
    .about-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    /* About stats */
    .about-stats {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    /* About image */
    .about-image {
        padding: 10px;
    }

    .about-image img {
        border-radius: 6px;
    }

    /* Contact image responsive */
    .contact-image {
        padding: 10px;
    }

    .contact-image img {
        border-radius: 6px;
    }

    /* Project cards */
    .project-card {
        margin-bottom: 10px;
    }

    .project-image {
        height: 180px;
    }

    /* Contact items */
    .contact-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    /* Social links - larger touch targets */
    .social-link {
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }

    /* Terminal improvements */
    .terminal-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .terminal-content {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    /* Top panel */
    .top-panel {
        font-size: 12px;
        padding: 0 6px;
        height: 32px;
    }

    .activities-btn {
        padding: 4px 8px;
        font-size: 12px;
    }

    /* Desktop icons */
    .desktop {
        grid-template-columns: repeat(auto-fill, 80px);
        grid-auto-rows: 90px;
        gap: 12px;
        padding: 12px;
        padding-bottom: 75px;
        justify-items: center;
    }

    .desktop-icon {
        width: 80px;
        height: 90px;
    }

    .desktop-icon i {
        font-size: 44px;
    }

    .desktop-icon span {
        font-size: 12px;
        line-height: 1.2;
        min-height: 14.4px; /* 12px * 1.2 line-height */
    }

    /* Window controls */
    .window-titlebar {
        padding: 8px 10px;
    }

    .window-title {
        font-size: 13px;
    }

    .window-btn {
        width: 18px;
        height: 18px;
        font-size: 9px;
    }

    .window-content {
        padding: 12px;
    }

    /* Text sizing */
    .about-content h2,
    .contact-info h2 {
        font-size: 1.5rem;
    }

    .skill-card h3,
    .project-info h3 {
        font-size: 1rem;
    }

    /* Dock */
    .dock {
        padding: 6px 8px;
        gap: 6px;
    }

    .dock-item {
        width: 42px;
        height: 42px;
        min-width: 42px;
        min-height: 42px;
    }

    .dock-item i {
        font-size: 20px;
    }

    /* Activities */
    .activities-overview {
        padding: 50px 12px;
    }

    .activities-search input {
        font-size: 16px;
        padding: 12px;
    }

    /* System icons */
    .system-icons {
        gap: 8px;
    }

    .system-icons i {
        font-size: 13px;
    }

    .power-btn {
        padding: 4px 6px;
    }
}

/* Landscape mode optimization for mobile */
@media (max-width: 896px) and (orientation: landscape) {
    .desktop {
        grid-template-columns: repeat(auto-fill, 70px);
        grid-auto-rows: 80px;
        gap: 10px;
        padding: 10px;
        justify-items: center;
    }

    .desktop-icon {
        width: 70px;
        height: 80px;
    }

    .desktop-icon i {
        font-size: 36px;
    }

    .desktop-icon span {
        font-size: 11px;
        line-height: 1.2;
        min-height: 13.2px; /* 11px * 1.2 line-height */
    }

    .dock {
        padding: 4px 8px;
    }

    .dock-item {
        width: 38px;
        height: 38px;
        min-width: 38px;
        min-height: 38px;
    }

    .dock-item i {
        font-size: 18px;
    }
}

/* Touch-specific optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Ensure all interactive elements are at least 44x44px */
    .window-btn {
        min-width: 44px;
        min-height: 44px;
    }

    .activities-btn,
    .power-btn {
        min-height: 32px;
        padding: 6px 12px;
    }

    /* Remove hover effects on touch devices */
    .desktop-icon:hover,
    .dock-item:hover,
    .skill-card:hover,
    .project-card:hover {
        transform: none;
    }

    /* Add active states for touch feedback */
    .desktop-icon:active {
        background: rgba(255, 255, 255, 0.2);
    }

    .dock-item:active {
        background: rgba(255, 255, 255, 0.3);
        transform: scale(0.95);
    }

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