/* ==========================================================================
   Waterbear SDK - Shared Styles
   ========================================================================== */

/* Reset & Base */
*, ::before, ::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --bg-input: #334155;
    --border-color: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --accent-primary: #3b82f6;
    --accent-primary-hover: #2563eb;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    --accent-purple: #8b5cf6;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Breakpoint: 900px - Reduce container padding */
@media (max-width: 900px) {
    .container {
        padding: 16px;
    }
}

/* ==========================================================================
   Header Styles
   ========================================================================== */

header {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border-bottom: 1px solid var(--border-color);
}

header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.header-content h1 {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.header-content .subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

.version-badge {
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.header-links {
    display: flex;
    gap: 12px;
    align-items: center;
}

.npm-badge {
    background: linear-gradient(135deg, #cb3837 0%, #a02827 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.npm-badge:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.npm-badge:active {
    transform: translateY(0);
}

/* ==========================================================================
   Main Grid Layout
   ========================================================================== */

.main-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
}

/* Breakpoint: 1200px - Reduce sidebar width on smaller laptops */
@media (max-width: 1200px) {
    .main-grid {
        grid-template-columns: 1fr 320px;
        gap: 20px;
    }
}

/* Breakpoint: 1024px - Switch to single column */
@media (max-width: 1024px) {
    .main-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .output-panel {
        position: static;
        top: auto;
    }
}

/* ==========================================================================
   Section Cards
   ========================================================================== */

.section-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
}

/* Breakpoint: 900px - Reduce card padding for space efficiency */
@media (max-width: 900px) {
    .section-card {
        padding: 20px;
        margin-bottom: 20px;
    }
}

/* Breakpoint: 768px - Further reduce padding for very small screens */
@media (max-width: 768px) {
    .section-card {
        padding: 16px;
        margin-bottom: 16px;
    }
}

.section-card:last-child {
    margin-bottom: 0;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

/* Breakpoint: 900px - Reduce header spacing */
@media (max-width: 900px) {
    .section-header {
        margin-bottom: 16px;
        padding-bottom: 12px;
        gap: 10px;
    }
}

.section-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.section-description {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 2px;
}

/* ==========================================================================
   Button Groups
   ========================================================================== */

.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.button-group--column {
    flex-direction: column;
}

/* Breakpoint: 900px - Reduce button gap for space efficiency */
@media (max-width: 900px) {
    .button-group {
        gap: 8px;
    }
}

/* ==========================================================================
   Buttons
   ========================================================================== */

button {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Breakpoint: 900px - Smaller button padding */
@media (max-width: 900px) {
    button {
        padding: 8px 14px;
        font-size: 13px;
    }
}

/* Breakpoint: 768px - Minimum button size */
@media (max-width: 768px) {
    button {
        padding: 8px 12px;
        font-size: 13px;
    }
}

button:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

button:active {
    transform: translateY(0);
}

button.btn-primary {
    border-color: var(--accent-primary);
    color: white;
}

button.btn-primary:hover {
    border-color: var(--accent-primary-hover);
}

button.btn-success {
    border-color: var(--accent-success);
    color: white;
}

button.btn-success:hover {
    border-color: #059669;
}

button.btn-warning {
    border-color: var(--accent-warning);
    color: #0f172a;
}

button.btn-warning:hover {
    border-color: #d97706;
}

button.btn-danger {
    border-color: var(--accent-danger);
    color: white;
}

button.btn-danger:hover {
    border-color: #dc2626;
}

/* ==========================================================================
   Console/Output Panel
   ========================================================================== */

.output-panel {
    position: sticky;
    top: 20px;
    height: fit-content;
}

.console-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.console-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.console-title::before {
    content: '';
    width: 10px;
    height: 10px;
    background: var(--accent-success);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.console-content {
    background: #000;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    min-height: 400px;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.5;
}

/* Breakpoint: 1200px - Reduce console height on smaller laptops */
@media (max-width: 1200px) {
    .console-content {
        min-height: 350px;
        max-height: calc(100vh - 140px);
    }
}

/* Breakpoint: 900px - Further reduce console height */
@media (max-width: 900px) {
    .console-content {
        min-height: 300px;
        max-height: calc(100vh - 120px);
        padding: 12px;
    }
}

/* Breakpoint: 768px - Minimum console height for very small screens */
@media (max-width: 768px) {
    .console-content {
        min-height: 250px;
        max-height: calc(100vh - 100px);
        padding: 10px;
    }
}

.console-content::-webkit-scrollbar {
    width: 8px;
}

.console-content::-webkit-scrollbar-track {
    background: var(--bg-input);
    border-radius: 4px;
}

.console-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.console-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

#result {
    white-space: pre-wrap;
    word-break: break-word;
}

/* Terminal Style */
.terminal-line {
    margin: 2px 0;
    line-height: 1.5;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
    animation: fadeIn 0.2s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-2px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.terminal-timestamp {
    color: #64748b;
    font-size: 11px;
    margin-right: 8px;
    user-select: none;
}

.terminal-content {
    color: #10b981;
    word-break: break-word;
}

/* ==========================================================================
   Code Display Block
   ========================================================================== */

.code-block {
    margin-top: 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.code-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-input);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s ease;
    user-select: none;
}

.code-block-header:hover {
    background: rgba(59, 130, 246, 0.1);
}

.code-block-header.active {
    background: rgba(59, 130, 246, 0.15);
}

.code-block-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.code-block-icon {
    transition: transform 0.3s ease;
    color: var(--accent-primary);
}

.code-block-header.active .code-block-icon {
    transform: rotate(90deg);
}

.code-block-actions {
    display: flex;
    gap: 8px;
}

.code-block-copy {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.code-block-copy:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
    transform: none;
    box-shadow: none;
}

.code-block-copy:active {
    transform: scale(0.95);
}

.code-block-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.2s ease;
    opacity: 0;
}

.code-block-content.expanded {
    max-height: 2000px;
    opacity: 1;
    overflow-y: auto;
}

.code-block-body {
    background: #0a0a0a;
    padding: 16px;
    margin: 0;
}

.code-block-body pre {
    margin: 0;
    padding: 0;
    overflow-x: auto;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.6;
    color: #e2e8f0;
    word-wrap: break-word;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Breakpoint: 768px - Smaller code font size on very small screens */
@media (max-width: 768px) {
    .code-block-body pre {
        font-size: 11px;
        line-height: 1.5;
    }
}

.code-block-body code {
    font-family: inherit;
}

/* Syntax Highlighting */
.code-token-keyword { color: #c678dd; }
.code-token-function { color: #61afef; }
.code-token-string { color: #98c379; }
.code-token-number { color: #d19a66; }
.code-token-comment { color: #5c6370; font-style: italic; }
.code-token-property { color: #e06c75; }
.code-token-operator { color: #56b6c2; }
.code-token-variable { color: #e5c07b; }
.code-token-bracket { color: #abb2bf; }

/* Code Block Scrollbar */
.code-block-content::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.code-block-content::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 4px;
}

.code-block-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.code-block-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

/* Header spacing */
header {
    padding: 32px 0;
    margin-bottom: 32px;
}

/* Breakpoint: 900px - Reduce header padding for vertical space */
@media (max-width: 900px) {
    header {
        padding: 24px 0;
        margin-bottom: 24px;
    }
}

/* Breakpoint: 768px - Minimum header spacing */
@media (max-width: 768px) {
    header {
        padding: 20px 0;
        margin-bottom: 20px;
    }
}

/* Mobile breakpoint: 640px */
@media (max-width: 640px) {
    header .container {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .header-content h1 {
        font-size: 22px;
    }

    .section-card {
        padding: 16px;
        margin-bottom: 16px;
    }

    button {
        width: 100%;
        justify-content: center;
        padding: 10px 12px;
    }

    .button-group {
        flex-direction: column;
        gap: 8px;
    }

    .console-content {
        min-height: 200px;
        max-height: calc(100vh - 80px);
        padding: 10px;
    }

    .code-block-body pre {
        font-size: 11px;
        line-height: 1.5;
    }
}
