/* =============================================================================
   Viewers (IDE & Web Browser)
   ============================================================================= */

/* Base Viewer */
.viewer {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-10);
    z-index: var(--z-modal);
    visibility: hidden;
    opacity: 0;
    transition: 
        visibility var(--transition-normal),
        opacity var(--transition-normal);
}

.viewer.is-active {
    visibility: visible;
    opacity: 1;
}

.viewer__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* =============================================================================
   IDE Window
   ============================================================================= */

.ide {
    position: relative;
    width: 100%;
    max-width: 1200px;
    height: 90vh;
    max-height: 850px;
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: var(--radius-md);
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(40px) scale(0.95);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.viewer.is-active .ide {
    transform: translateY(0) scale(1);
}

.ide__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 40px;
    padding: 0 var(--space-4);
    background: #323233;
    border-bottom: 1px solid #333;
}

.ide__title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.ide__name {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    color: #ccc;
}

.ide__file {
    font-family: var(--font-mono);
    font-size: var(--font-size-xs);
    color: #888;
}

.ide__actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.ide__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 50%;
    color: #ccc;
    text-decoration: none;
    cursor: pointer;
    transition: 
        background var(--transition-normal),
        color var(--transition-normal),
        transform var(--transition-normal);
}

.ide__btn svg {
    width: 18px;
    height: 18px;
}

.ide__btn--repo:hover {
    background: #fc6d26;
    border-color: #fc6d26;
    color: white;
}

.ide__btn--close {
    font-size: var(--font-size-xl);
}

.ide__btn--close:hover {
    color: white;
    transform: rotate(90deg);
}

.ide__body {
    flex: 1;
    overflow: hidden;
    background: #1e1e1e;
}

.ide__editor {
    height: 100%;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.ide__editor::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.ide__editor::-webkit-scrollbar-track {
    background: #1e1e1e;
}

.ide__editor::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 5px;
}

.ide__code {
    display: block;
    padding: var(--space-4);
    font-family: var(--font-mono);
    font-size: var(--font-size-xs);
    line-height: 1.6;
    white-space: pre;
    background: transparent !important;
}

.ide__statusbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 24px;
    padding: 0 var(--space-3);
    background: #007acc;
    font-family: var(--font-mono);
    font-size: 11px;
    color: white;
}

/* IDE States */
.ide__loading,
.ide__error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: var(--space-4);
    color: #888;
}

.ide__error {
    color: #ff6b6b;
    text-align: center;
    padding: var(--space-5);
}

.ide__error svg {
    width: 48px;
    height: 48px;
    stroke: currentColor;
    fill: none;
}

/* =============================================================================
   Browser Window
   ============================================================================= */

.browser {
    position: relative;
    width: 100%;
    max-width: 1200px;
    height: 90vh;
    max-height: 850px;
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: var(--radius-md);
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(40px) scale(0.95);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.viewer.is-active .browser {
    transform: translateY(0) scale(1);
}

.browser__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 40px;
    padding: 0 var(--space-4);
    background: #323233;
    border-bottom: 1px solid #333;
}

.browser__title {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    color: #ccc;
}

.browser__actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.browser__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 50%;
    color: #ccc;
    text-decoration: none;
    cursor: pointer;
    transition: 
        background var(--transition-normal),
        border-color var(--transition-normal),
        color var(--transition-normal),
        transform var(--transition-normal);
}

.browser__btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.browser__btn--repo:hover {
    background: #333;
    border-color: #555;
    color: white;
}

.browser__btn--external:hover {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: white;
}

.browser__btn--close {
    font-size: var(--font-size-xl);
}

.browser__btn--close:hover {
    color: white;
    transform: rotate(90deg);
}

.browser__body {
    flex: 1;
    position: relative;
    background: #1e1e1e;
    overflow: hidden;
}

.browser__body iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #1e1e1e;
}

.browser__loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
    background: #1e1e1e;
    color: #888;
}
