/* =============================================================
   Melanie OS 8 Metro UI Theme
   All selectors scoped under #desktop-win8
   ============================================================= */

/* ── Fonts ─────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;600;700&display=swap');

/* ── Desktop Background ───────────────────────────────────── */
#desktop-win8 {
    background: linear-gradient(135deg, #1e1e2e 0%, #2d1b4e 50%, #1a1a3e 100%);
    font-family: 'Segoe UI', 'Open Sans', sans-serif;
    color: #fff;
    overflow: hidden;
    position: relative;
}

/* ── METRO START SCREEN ───────────────────────────────────── */
#desktop-win8 .metro-start-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 40px 0 0 0;
    box-sizing: border-box;
    z-index: 100;
    overflow: hidden;
}

/* ── Start Header ─────────────────────────────────────────── */
#desktop-win8 .metro-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 80px 30px 80px;
    flex-shrink: 0;
}

#desktop-win8 .metro-title {
    font-size: 42px;
    font-weight: 300;
    letter-spacing: -0.5px;
    margin: 0;
    color: #fff;
}

#desktop-win8 .metro-user {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: default;
}

#desktop-win8 .metro-username {
    font-size: 15px;
    font-weight: 400;
    color: #fff;
}

#desktop-win8 .metro-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    line-height: 1;
}

/* ── Tiles Container (horizontal scroll) ──────────────────── */
#desktop-win8 .metro-tiles-container {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 40px;
    padding: 0 80px 40px 80px;
    overflow-x: auto;
    overflow-y: hidden;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.25) transparent;
}

#desktop-win8 .metro-tiles-container::-webkit-scrollbar {
    height: 6px;
}

#desktop-win8 .metro-tiles-container::-webkit-scrollbar-track {
    background: transparent;
}

#desktop-win8 .metro-tiles-container::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.25);
    border-radius: 3px;
}

/* ── Tile Groups ──────────────────────────────────────────── */
#desktop-win8 .metro-tile-group {
    flex-shrink: 0;
}

#desktop-win8 .tile-group-label {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.7);
    margin: 0 0 12px 4px;
}

#desktop-win8 .tile-group-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, 150px);
    grid-auto-rows: 150px;
    grid-auto-flow: dense;
    gap: 8px;
}

/* ── Metro Tiles ──────────────────────────────────────────── */
#desktop-win8 .metro-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    user-select: none;
    transition: filter 0.15s ease, transform 0.15s ease;
}

#desktop-win8 .metro-tile:hover {
    filter: brightness(1.12);
    transform: scale(1.02);
}

#desktop-win8 .metro-tile:active {
    transform: scale(0.97);
    filter: brightness(0.95);
}

/* Tile Sizes */
#desktop-win8 .metro-tile.tile-small {
    grid-column: span 1;
    grid-row: span 1;
    width: 70px;
    height: 70px;
}

#desktop-win8 .metro-tile.tile-medium {
    grid-column: span 1;
    grid-row: span 1;
    width: 150px;
    height: 150px;
}

#desktop-win8 .metro-tile.tile-wide {
    grid-column: span 2;
    grid-row: span 1;
    width: 310px;
    height: 150px;
}

#desktop-win8 .metro-tile.tile-large {
    grid-column: span 2;
    grid-row: span 2;
    width: 310px;
    height: 310px;
}

/* Tile Colors via data-color */
#desktop-win8 .metro-tile[data-color="blue"]   { background: #2672EC; }
#desktop-win8 .metro-tile[data-color="green"]  { background: #00A300; }
#desktop-win8 .metro-tile[data-color="purple"] { background: #7E3878; }
#desktop-win8 .metro-tile[data-color="orange"] { background: #DA532C; }
#desktop-win8 .metro-tile[data-color="red"]    { background: #B91D47; }
#desktop-win8 .metro-tile[data-color="teal"]   { background: #00ABA9; }
#desktop-win8 .metro-tile[data-color="dark"]   { background: #2D2D2D; }
#desktop-win8 .metro-tile[data-color="cyan"]   { background: #199FD3; }

/* Tile Icon */
#desktop-win8 .tile-icon {
    font-size: 48px;
    line-height: 1;
    text-align: center;
    color: #fff;
    flex-shrink: 0;
}

/* Tile Label */
#desktop-win8 .tile-label {
    position: absolute;
    bottom: 8px;
    left: 10px;
    font-size: 12px;
    font-weight: 400;
    color: #fff;
    line-height: 1.2;
    max-width: calc(100% - 20px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Tile Detail (subtitle on wide tiles) */
#desktop-win8 .tile-detail {
    position: absolute;
    bottom: 26px;
    left: 10px;
    font-size: 11px;
    font-weight: 300;
    color: rgba(255,255,255,0.8);
    max-width: calc(100% - 20px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Profile tile bio content */
#desktop-win8 .metro-tile:has(.tile-content-bio) {
    justify-content: flex-start;
}

#desktop-win8 .tile-content-bio {
    padding: 14px 16px 8px 16px;
    text-align: left;
    width: 100%;
    box-sizing: border-box;
}

#desktop-win8 .tile-bio-name {
    font-size: 22px;
    font-weight: 300;
    color: #fff;
    margin-bottom: 4px;
}

#desktop-win8 .tile-bio-title {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    margin-bottom: 12px;
}

#desktop-win8 .tile-bio-text {
    font-size: 12px;
    font-weight: 400;
    color: rgba(255,255,255,0.75);
    line-height: 1.5;
}

/* ── Tile Entrance Animations ─────────────────────────────── */
#desktop-win8 .metro-tile {
    opacity: 0;
    transform: translateY(30px);
}

#desktop-win8 .metro-tile.tile-entered {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.4s cubic-bezier(0.215, 0.61, 0.355, 1),
                transform 0.4s cubic-bezier(0.215, 0.61, 0.355, 1),
                filter 0.15s ease;
}

/* ── METRO APPS (full screen panels) ──────────────────────── */
#desktop-win8 .metro-app {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 200;
    display: flex;
    flex-direction: column;
    animation: win8SlideIn 0.35s cubic-bezier(0.215, 0.61, 0.355, 1) forwards;
}

@keyframes win8SlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

#desktop-win8 .metro-app.app-closing {
    animation: win8SlideOut 0.25s cubic-bezier(0.55, 0.085, 0.68, 0.53) forwards;
}

@keyframes win8SlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ── App Titlebar ─────────────────────────────────────────── */
#desktop-win8 .app-titlebar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 30px;
    flex-shrink: 0;
    background: transparent;
}

#desktop-win8 .app-back-btn {
    background: none;
    border: 2px solid rgba(255,255,255,0.7);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, border-color 0.15s ease;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
}

#desktop-win8 .app-back-btn:hover {
    background: rgba(255,255,255,0.15);
    border-color: #fff;
}

#desktop-win8 .app-title {
    font-size: 28px;
    font-weight: 300;
    color: #fff;
    margin: 0;
}

#desktop-win8 .app-content {
    flex: 1;
    overflow: auto;
    position: relative;
}

/* ── PC INFO APP ──────────────────────────────────────────── */
#desktop-win8 #win8-sysinfo {
    background: #1d1d1d;
}

#desktop-win8 .pcinfo-layout {
    display: flex;
    height: 100%;
}

#desktop-win8 .pcinfo-sidebar {
    width: 240px;
    flex-shrink: 0;
    padding: 10px 0;
    background: #111;
    border-right: 1px solid #333;
}

#desktop-win8 .pcinfo-nav-item {
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 400;
    color: rgba(255,255,255,0.6);
    cursor: default;
    transition: background 0.15s ease;
}

#desktop-win8 .pcinfo-nav-item.active {
    color: #fff;
    background: rgba(255,255,255,0.08);
    border-left: 3px solid #00ABA9;
    padding-left: 21px;
}

#desktop-win8 .pcinfo-nav-item:hover {
    background: rgba(255,255,255,0.05);
}

#desktop-win8 .pcinfo-main {
    flex: 1;
    padding: 30px 50px;
    overflow-y: auto;
}

#desktop-win8 .pcinfo-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 40px;
}

#desktop-win8 .pcinfo-pc-icon {
    font-size: 64px;
    line-height: 1;
}

#desktop-win8 .pcinfo-name-label {
    font-size: 28px;
    font-weight: 300;
    color: #fff;
}

#desktop-win8 .pcinfo-edition {
    font-size: 14px;
    font-weight: 400;
    color: rgba(255,255,255,0.5);
    margin-top: 4px;
}

#desktop-win8 .pcinfo-details {
    margin-bottom: 40px;
}

#desktop-win8 .pcinfo-row {
    display: flex;
    padding: 10px 0;
    border-bottom: 1px solid #2a2a2a;
}

#desktop-win8 .pcinfo-key {
    width: 220px;
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 400;
    color: rgba(255,255,255,0.5);
}

#desktop-win8 .pcinfo-value {
    font-size: 14px;
    font-weight: 400;
    color: #fff;
}

#desktop-win8 .pcinfo-skills-title {
    font-size: 18px;
    font-weight: 300;
    color: #fff;
    margin: 0 0 16px 0;
}

#desktop-win8 .pcinfo-skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

#desktop-win8 .pcinfo-tag {
    display: inline-block;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 400;
    color: #fff;
    cursor: default;
}

#desktop-win8 .pcinfo-tag[data-color="blue"]   { background: #2672EC; }
#desktop-win8 .pcinfo-tag[data-color="green"]  { background: #00A300; }
#desktop-win8 .pcinfo-tag[data-color="purple"] { background: #7E3878; }
#desktop-win8 .pcinfo-tag[data-color="orange"] { background: #DA532C; }
#desktop-win8 .pcinfo-tag[data-color="teal"]   { background: #00ABA9; }

/* ── MAIL APP ─────────────────────────────────────────────── */
#desktop-win8 #win8-mail {
    background: #fff;
}

#desktop-win8 #win8-mail .app-titlebar {
    background: #2672EC;
}

#desktop-win8 #win8-mail .app-back-btn {
    border-color: rgba(255,255,255,0.8);
}

#desktop-win8 .mail-layout {
    display: flex;
    height: 100%;
}

#desktop-win8 .mail-sidebar {
    width: 200px;
    flex-shrink: 0;
    background: #f5f5f5;
    border-right: 1px solid #e0e0e0;
    padding: 10px 0;
}

#desktop-win8 .mail-folder {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    font-size: 14px;
    color: #333;
    cursor: default;
    transition: background 0.15s ease;
}

#desktop-win8 .mail-folder.active {
    background: #2672EC;
    color: #fff;
}

#desktop-win8 .mail-folder:hover:not(.active) {
    background: #e8e8e8;
}

#desktop-win8 .mail-folder-icon {
    font-size: 16px;
}

#desktop-win8 .mail-folder-name {
    font-weight: 400;
}

#desktop-win8 .mail-compose {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#desktop-win8 .mail-compose-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 30px;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}

#desktop-win8 .mail-compose-title {
    font-size: 20px;
    font-weight: 300;
    color: #333;
    margin: 0;
}

#desktop-win8 .mail-send-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 28px;
    background: #2672EC;
    color: #fff;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
    font-family: inherit;
}

#desktop-win8 .mail-send-btn:hover {
    background: #1a5cc7;
}

#desktop-win8 .mail-send-icon {
    font-size: 16px;
}

#desktop-win8 .mail-compose-fields {
    padding: 0 30px;
    flex-shrink: 0;
}

#desktop-win8 .mail-field {
    display: flex;
    align-items: center;
    border-bottom: 1px solid #e8e8e8;
}

#desktop-win8 .mail-field-label {
    width: 70px;
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 600;
    color: #888;
    padding: 14px 0;
}

#desktop-win8 .mail-field-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 15px;
    font-family: inherit;
    color: #222;
    padding: 14px 8px;
    background: transparent;
    transition: border-color 0.2s ease;
}

#desktop-win8 .mail-field-input:focus {
    border-bottom: 2px solid #2672EC;
    margin-bottom: -1px;
}

#desktop-win8 .mail-field-input::placeholder {
    color: #bbb;
}

#desktop-win8 .mail-field-input[readonly] {
    color: #666;
}

#desktop-win8 .mail-compose-body {
    flex: 1;
    padding: 0 30px 20px 30px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#desktop-win8 .mail-body-textarea {
    flex: 1;
    border: none;
    outline: none;
    font-size: 15px;
    font-family: inherit;
    color: #222;
    padding: 20px 8px;
    resize: none;
    background: transparent;
    min-height: 200px;
}

#desktop-win8 .mail-body-textarea::placeholder {
    color: #bbb;
}

#desktop-win8 .mail-body-textarea:focus {
    border-left: 2px solid #2672EC;
    padding-left: 6px;
}

/* ── TERMINAL APP ─────────────────────────────────────────── */
#desktop-win8 #win8-terminal {
    background: #0c0c0c;
}

#desktop-win8 .app-titlebar-dark {
    background: #1a1a1a;
}

#desktop-win8 .app-content-terminal {
    display: flex;
}

#desktop-win8 #win8-terminal .terminal-container {
    flex: 1;
    background: #0c0c0c;
    color: #cccccc;
    font-family: 'Consolas', 'Courier New', monospace;
    padding: 10px;
    overflow-y: auto;
}

/* ── CHARMS BAR ───────────────────────────────────────────── */
#desktop-win8 .charms-bar {
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 20px 0;
    transform: translateX(100%);
    transition: transform 0.25s cubic-bezier(0.215, 0.61, 0.355, 1);
}

#desktop-win8 .charms-bar.visible {
    transform: translateX(0);
}

#desktop-win8 .charm {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 12px 8px;
    width: 100%;
    cursor: pointer;
    transition: background 0.15s ease;
}

#desktop-win8 .charm:hover {
    background: rgba(255, 255, 255, 0.1);
}

#desktop-win8 .charm-icon {
    font-size: 22px;
    color: #fff;
    line-height: 1;
}

#desktop-win8 .charm-label {
    font-size: 10px;
    font-weight: 400;
    color: rgba(255,255,255,0.8);
    text-align: center;
}

/* ── Charms Trigger Zone ──────────────────────────────────── */
#desktop-win8 .charms-trigger {
    position: absolute;
    top: 0;
    right: 0;
    width: 15px;
    height: 100%;
    z-index: 499;
    cursor: pointer;
}

/* ── BOTTOM APP BAR ───────────────────────────────────────── */
#desktop-win8 .app-bar-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 48px;
    background: #1a1a1a;
    border-top: 1px solid #333;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 20px;
    z-index: 150;
    box-sizing: border-box;
    opacity: 0;
    transform: translateY(100%);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

#desktop-win8 .app-bar-bottom.visible {
    opacity: 1;
    transform: translateY(0);
}

#desktop-win8 .app-bar-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: #fff;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    padding: 8px 16px;
    transition: background 0.15s ease;
}

#desktop-win8 .app-bar-btn:hover {
    background: rgba(255,255,255,0.1);
}

#desktop-win8 .app-bar-icon {
    font-size: 18px;
}

/* ── Responsive / Small Screen ────────────────────────────── */
@media (max-width: 900px) {
    #desktop-win8 .metro-header {
        padding: 0 30px 20px 30px;
    }
    #desktop-win8 .metro-title {
        font-size: 30px;
    }
    #desktop-win8 .metro-tiles-container {
        padding: 0 30px 30px 30px;
        gap: 24px;
    }
    #desktop-win8 .pcinfo-sidebar {
        display: none;
    }
    #desktop-win8 .mail-sidebar {
        display: none;
    }
    #desktop-win8 .pcinfo-main {
        padding: 20px 24px;
    }
    #desktop-win8 .pcinfo-key {
        width: 160px;
    }
}

@media (max-width: 600px) {
    #desktop-win8 .metro-tile.tile-wide {
        width: 150px;
        grid-column: span 1;
    }
    #desktop-win8 .metro-tile.tile-large {
        width: 150px;
        height: 150px;
        grid-column: span 1;
        grid-row: span 1;
    }
    #desktop-win8 .tile-content-bio {
        padding: 10px 10px 30px 10px;
    }
    #desktop-win8 .tile-bio-name {
        font-size: 16px;
    }
    #desktop-win8 .tile-bio-title {
        font-size: 11px;
    }
    #desktop-win8 .tile-bio-text {
        display: none;
    }
    #desktop-win8 .tile-detail {
        display: none;
    }
    #desktop-win8 .pcinfo-row {
        flex-direction: column;
        gap: 2px;
    }
    #desktop-win8 .pcinfo-key {
        width: auto;
    }
    #desktop-win8 .mail-compose-fields {
        padding: 0 16px;
    }
    #desktop-win8 .mail-compose-body {
        padding: 0 16px 16px 16px;
    }
    #desktop-win8 .mail-compose-header {
        padding: 12px 16px;
    }
}

/* ── Switch OS Header Button ──────────────────────────────── */
#desktop-win8 .metro-header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

#desktop-win8 .metro-switch-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    font-family: 'Segoe UI', 'Open Sans', sans-serif;
    font-size: 13px;
    font-weight: 400;
    cursor: pointer;
    letter-spacing: 0.03em;
    transition: background 0.15s, border-color 0.15s;
}

#desktop-win8 .metro-switch-btn:hover {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.55);
}

#desktop-win8 .metro-switch-btn:active {
    background: rgba(255, 255, 255, 0.32);
}

/* ── Flower Icon Sizing ────────────────────────────────────── */
#desktop-win8 .win8-flower-icon {
    width: 14px;
    height: 14px;
    vertical-align: middle;
}
#desktop-win8 .win8-charm-flower {
    width: 22px;
    height: 22px;
    margin-bottom: 4px;
}
#desktop-win8 .win8-appbar-flower {
    width: 18px;
    height: 18px;
}

#desktop-win8 .mail-compose-altcha {
    padding: 15px 30px;
    border-top: 1px solid #e0e0e0;
    flex-shrink: 0;
}

#desktop-win8 .contact-form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

/* ── News Live Tile ─────────────────────────── */
#desktop-win8 .tile-news {
    cursor: default;
    padding: 0;
    overflow: hidden;
}

#desktop-win8 .tile-news-window {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 24px; /* leave room for .tile-label */
    overflow: hidden;
    padding: 4px 10px 0;
}

#desktop-win8 .tile-news-track {
    display: flex;
    flex-direction: column;
    will-change: transform;
}

#desktop-win8 .tile-news-item {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    height: 55px;
    min-height: 55px;
    max-height: 55px;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
    overflow: hidden;
    text-decoration: none;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

#desktop-win8 .tile-news-item:hover {
    text-decoration: underline;
}

#desktop-win8 .tile-news .tile-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
}

