/* ===== ENHANCED RESPONSIVE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Fira Code", "Courier New", monospace;
}

:root {
    --primary-bg: #1a1b26;
    --terminal-bg: #16161e;
    --header-bg: #1f2335;
    --border-color: #2a2e3d;
    --text-primary: #a9b1d6;
    --text-secondary: #737aa2;
    --text-accent: #c0caf5;
    --prompt-color: #9ece6a;
    --command-color: #7dcfff;
    --dir-color: #7aa2f7;
    --file-color: #7dcfff;
    --back-color: #e0af68;
    --danger: #f7768e;
    --warning: #e0af68;
    --success: #9ece6a;
}

body {
    background-color: var(--primary-bg);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
    transition: overflow 0.3s ease;
}

body.no-scroll {
    overflow: hidden;
}

body.no-scroll::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 999;
}

.terminal-container {
    width: 100%;
    max-width: min(900px, 100%);
    background-color: var(--terminal-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 500px;
    max-height: 90vh;
    position: relative;
    z-index: 1;
}

.terminal-header {
    background-color: var(--header-bg);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.terminal-buttons {
    display: flex;
    gap: 8px;
}

.terminal-button {
    width: 14px;
    height: 14px;
    border-radius: 50%;
}

.button-close {
    background-color: var(--danger);
}

.button-minimize {
    background-color: var(--warning);
}

.button-maximize {
    background-color: var(--success);
}

.terminal-title {
    color: var(--text-accent);
    font-size: 14px;
    margin-left: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1;
}

.terminal-body {
    padding: 20px;
    overflow-y: auto;
    background-color: var(--terminal-bg);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.terminal-line {
    margin-bottom: 10px;
    line-height: 1.5;
    white-space: pre-wrap;
    display: flex;
    flex-wrap: wrap;
    word-break: break-word;
}

.terminal-prompt {
    color: var(--prompt-color);
    font-weight: bold;
    white-space: nowrap;
    margin-right: 5px;
    flex-shrink: 0;
}

.terminal-command {
    color: var(--command-color);
    word-break: break-all;
}

.terminal-output {
    color: var(--text-accent);
    width: 100%;
    margin-top: 5px;
    padding-left: 0;
    word-break: break-word;
}

.directory-listing {
    margin: 12px 0;
    width: 100%;
}

.dir-item,
.file-item,
.back-item {
    cursor: pointer;
    padding: 12px;
    margin: 8px 0;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    position: relative;
    background-color: rgba(122, 162, 247, 0.05);
    min-height: 44px;
    /* Better touch targets */
}

.dir-item {
    color: var(--dir-color);
    border-left: 4px solid var(--dir-color);
}

.dir-item:hover {
    background-color: rgba(122, 162, 247, 0.15);
    color: #bb9af7;
    border-left-color: #bb9af7;
}

.dir-item::before {
    content: "📁 ";
    margin-right: 10px;
    font-size: 16px;
}

.file-item {
    color: var(--file-color);
    border-left: 4px solid var(--file-color);
}

.file-item:hover {
    background-color: rgba(125, 207, 255, 0.15);
    color: #2ac3de;
    border-left-color: #2ac3de;
}

.file-item::before {
    content: "📄 ";
    margin-right: 10px;
    font-size: 16px;
}

.back-item {
    color: var(--back-color);
    border-left: 4px solid var(--back-color);
}

.back-item:hover {
    background-color: rgba(224, 175, 104, 0.15);
    color: #ff9e64;
    border-left-color: #ff9e64;
}

.back-item::before {
    content: "↩ ";
    margin-right: 10px;
    font-size: 16px;
}

.cursor {
    display: inline-block;
    width: 8px;
    height: 16px;
    background-color: var(--prompt-color);
    animation: blink 1s infinite;
    vertical-align: middle;
}

.help-text,
.nav-help {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 15px;
    padding: 12px;
    background-color: var(--primary-bg);
    border-radius: 6px;
    border-left: 4px solid var(--dir-color);
}

.nav-help {
    border-left-color: var(--prompt-color);
}

.item-info {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-secondary);
    text-align: right;
}

.detail-panel {
    width: 100%;
    max-width: min(900px, 100%);
    background-color: var(--primary-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
    max-height: 90vh;
    overflow: hidden;
    transition: height 0.3s ease;
}

.detail-panel.visible {
    display: block;
    animation: fadeIn 0.3s ease;
}

.detail-header {
    color: #bb9af7;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background-color: var(--primary-bg);
    z-index: 10;
}

.detail-content {
    line-height: 1.6;
    color: var(--text-accent);
    font-family: "Fira Code", monospace;
    overflow-y: auto;
    max-height: calc(90vh - 100px);
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 24px;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    flex-shrink: 0;
}

.close-btn:hover {
    background-color: var(--border-color);
    color: var(--danger);
}

/* Content styling for HTML elements */
.content-container {
    padding: 10px 0;
}

.icon-header {
    font-size: 3rem;
    text-align: center;
    margin: 15px 0;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

.content-heading {
    color: #bb9af7;
    margin: 20px 0 10px 0;
    font-size: 1.5em;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 5px;
}

.content-paragraph {
    margin-bottom: 15px;
    line-height: 1.6;
}

.content-list {
    margin-left: 20px;
    margin-bottom: 20px;
}

.content-list li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.content-highlight {
    color: #7dcfff;
    font-weight: bold;
}

/* Animations */
@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -48%);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.slide-in {
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollbar styling */
.terminal-body::-webkit-scrollbar,
.detail-panel::-webkit-scrollbar,
.detail-content::-webkit-scrollbar {
    width: 8px;
}

.terminal-body::-webkit-scrollbar-track,
.detail-panel::-webkit-scrollbar-track,
.detail-content::-webkit-scrollbar-track {
    background: var(--primary-bg);
}

.terminal-body::-webkit-scrollbar-thumb,
.detail-panel::-webkit-scrollbar-thumb,
.detail-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.terminal-body::-webkit-scrollbar-thumb:hover,
.detail-panel::-webkit-scrollbar-thumb:hover,
.detail-content::-webkit-scrollbar-thumb:hover {
    background: #3b4261;
}

/* ===== RESPONSIVE BREAKPOINTS ===== */
/* Large devices (desktops, less than 1200px) */
@media (max-width: 1199.98px) {
    .terminal-container {
        max-width: 95%;
    }
}

/* Medium devices (tablets, less than 992px) */
@media (max-width: 991.98px) {
    body {
        padding: 15px;
    }

    .terminal-body {
        padding: 15px;
    }

    .detail-panel {
        padding: 15px;
    }
}

/* Small devices (landscape phones, less than 768px) */
@media (max-width: 767.98px) {
    body {
        padding: 10px;
    }

    .terminal-container {
        border-radius: 6px;
        margin-bottom: 15px;
        max-height: 85vh;
    }

    .terminal-header {
        padding: 10px 12px;
    }

    .terminal-body {
        padding: 12px;
    }

    .terminal-line {
        font-size: 14px;
        margin-bottom: 8px;
        flex-direction: column;
        align-items: flex-start;
    }

    .terminal-prompt {
        margin-bottom: 4px;
    }

    .dir-item,
    .file-item,
    .back-item {
        padding: 10px;
        margin: 6px 0;
        font-size: 14px;
        flex-direction: column;
        align-items: flex-start;
    }

    .item-info {
        margin-left: 0;
        margin-top: 5px;
        font-size: 11px;
        text-align: left;
        width: 100%;
    }

    .detail-panel {
        padding: 12px;
        width: 95%;
    }

    .detail-content {
        max-height: calc(90vh - 80px);
    }

    .detail-header {
        margin-bottom: 12px;
    }

    .content-heading {
        font-size: 1.3em;
    }

    .help-text,
    .nav-help {
        font-size: 12px;
        padding: 10px;
    }

    .icon-header {
        font-size: 2.5rem;
    }
}

/* Extra small devices (portrait phones, less than 576px) */
@media (max-width: 575.98px) {
    body {
        padding: 8px;
    }

    .terminal-header {
        padding: 8px 10px;
    }

    .terminal-title {
        font-size: 12px;
        margin-left: 8px;
    }

    .terminal-buttons {
        gap: 6px;
    }

    .terminal-button {
        width: 12px;
        height: 12px;
    }

    .terminal-body {
        padding: 10px;
        max-height: 75vh;
    }

    .terminal-line {
        font-size: 13px;
    }

    .dir-item,
    .file-item,
    .back-item {
        padding: 12px 10px;
        margin: 5px 0;
    }

    .dir-item::before,
    .file-item::before,
    .back-item::before {
        margin-right: 8px;
        font-size: 14px;
    }

    .detail-panel {
        padding: 10px;
        width: 98%;
    }

    .detail-content {
        max-height: calc(90vh - 70px);
    }

    .detail-header h3 {
        font-size: 16px;
    }

    .close-btn {
        width: 32px;
        height: 32px;
        font-size: 20px;
    }

    .content-heading {
        font-size: 1.2em;
    }

    .content-list {
        padding-left: 16px;
    }

    .help-text,
    .nav-help {
        font-size: 11px;
        padding: 8px 10px;
    }

    .icon-header {
        font-size: 2rem;
    }
}

/* Very small devices (less than 400px) */
@media (max-width: 399.98px) {
    .terminal-header {
        flex-wrap: wrap;
    }

    .terminal-title {
        width: 100%;
        margin-top: 8px;
        margin-left: 0;
        order: 2;
    }

    .terminal-line {
        font-size: 12px;
    }

    .dir-item,
    .file-item,
    .back-item {
        font-size: 13px;
    }

    .item-info {
        font-size: 10px;
    }

    .content-heading {
        font-size: 1.1em;
    }

    .icon-header {
        font-size: 1.8rem;
    }
}

/* Touch device improvements */
@media (hover: none) and (pointer: coarse) {

    .dir-item:hover,
    .file-item:hover,
    .back-item:hover {
        background-color: inherit;
        color: inherit;
        border-left-color: inherit;
    }

    .dir-item:active,
    .file-item:active,
    .back-item:active {
        background-color: rgba(122, 162, 247, 0.15);
    }

    .close-btn:hover {
        background-color: inherit;
        color: inherit;
    }

    .close-btn:active {
        background-color: var(--border-color);
        color: var(--danger);
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --primary-bg: #000;
        --terminal-bg: #111;
        --header-bg: #222;
        --border-color: #444;
        --text-primary: #fff;
        --text-secondary: #ccc;
        --text-accent: #eee;
    }

    .dir-item,
    .file-item,
    .back-item {
        border-left-width: 6px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .cursor {
        animation: none;
        opacity: 1;
    }

    .icon-header {
        animation: none;
    }
}

/* Additional responsive styles for the terminal iframe */
.terminal-container {
    width: 100% !important;
    max-width: 100% !important;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.terminal-body {
    flex-grow: 1;
    overflow-y: auto;
}

/* Better mobile experience for terminal */
@media (max-width: 768px) {
    .terminal-header {
        padding: 10px 12px !important;
    }

    .terminal-body {
        padding: 12px !important;
    }

    .terminal-line {
        font-size: 14px !important;
        margin-bottom: 8px !important;
    }

    .dir-item,
    .file-item,
    .back-item {
        padding: 10px !important;
        margin: 6px 0 !important;
    }

    .help-text,
    .nav-help {
        font-size: 12px !important;
        padding: 10px !important;
    }
}

@media (max-width: 576px) {
    .terminal-title {
        font-size: 12px !important;
    }

    .terminal-buttons {
        gap: 6px !important;
    }

    .terminal-button {
        width: 12px !important;
        height: 12px !important;
    }

    .dir-item,
    .file-item,
    .back-item {
        padding: 8px 10px !important;
        font-size: 14px !important;
    }

    .item-info {
        font-size: 11px !important;
    }
}