* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(233, 176, 69, 0.16), transparent 28%),
        radial-gradient(circle at top right, rgba(74, 138, 196, 0.14), transparent 34%),
        linear-gradient(180deg, #151618 0%, #101114 100%);
    color: #ffffff;
    overflow: hidden;
}

.app-activity {
    position: fixed;
    top: 18px;
    right: 22px;
    z-index: 1200;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(13, 15, 19, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #dfe6ee;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(12px);
}

.app-activity.hidden {
    display: none;
}

.activity-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #e8bc6a;
    box-shadow: 0 0 0 0 rgba(232, 188, 106, 0.55);
    animation: activityPulse 1.2s ease-out infinite;
}

@keyframes activityPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(232, 188, 106, 0.55);
    }
    100% {
        box-shadow: 0 0 0 12px rgba(232, 188, 106, 0);
    }
}

.connection-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background: rgba(9, 10, 12, 0.78);
    backdrop-filter: blur(18px);
}

.connection-overlay.hidden {
    display: none;
}

.connection-shell {
    width: min(980px, 100%);
}

.connection-card {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 28px;
    padding: 30px;
    background:
        linear-gradient(140deg, rgba(32, 35, 41, 0.96), rgba(18, 20, 25, 0.96));
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}

.connection-header {
    margin-bottom: 26px;
}

.connection-eyebrow {
    font-size: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #e8bc6a;
    margin-bottom: 10px;
}

.connection-header h1 {
    font-size: clamp(32px, 5vw, 52px);
    line-height: 1;
    margin-bottom: 12px;
}

.connection-copy {
    max-width: 700px;
    color: #bcc2ca;
    line-height: 1.5;
}

.connection-form {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.connection-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
    gap: 18px;
}

.connection-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.remember-field {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
}

.remember-copy {
    font-size: 12px;
    color: #9ea6af;
}

.remember-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    color: #d7dde5;
}

.connection-panels {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.connection-panel {
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.025);
}

.panel-heading h2,
.optional-heading h2 {
    font-size: 18px;
    margin-bottom: 4px;
}

.panel-heading p,
.optional-heading p {
    color: #9ea6af;
    font-size: 13px;
    line-height: 1.5;
}

.panel-divider {
    height: 1px;
    background: linear-gradient(90deg, rgba(255,255,255,0.16), rgba(255,255,255,0));
    margin: 8px 0;
}

.connection-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.connection-status-stack {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.primary-action,
.secondary-action,
.ghost-action,
.source-settings-btn {
    border: none;
    border-radius: 999px;
    padding: 12px 18px;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.18s ease, background-color 0.18s ease, opacity 0.18s ease;
}

.primary-action {
    background: #e8bc6a;
    color: #1b1d20;
    font-weight: 700;
}

.secondary-action {
    background: #304f68;
    color: #e8f4ff;
}

.ghost-action {
    background: rgba(255, 255, 255, 0.08);
    color: #d7dde5;
}

.source-settings-btn {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.primary-action:hover,
.secondary-action:hover,
.ghost-action:hover,
.source-settings-btn:hover {
    transform: translateY(-1px);
}

.connection-test-status {
    color: #b9c2cb;
    font-size: 13px;
    min-height: 18px;
}

.connection-test-status.success {
    color: #7de0a6;
}

.connection-test-status.error {
    color: #ff8f8f;
}

.saved-connection-status {
    color: #8f98a3;
    font-size: 12px;
    min-height: 16px;
}

.saved-connection-status.saved {
    color: #8ec5ff;
}

.app-container {
    display: flex;
    height: 100vh;
    gap: 28px;
    padding: 24px;
}

/* AWS Browser Styles */
.aws-browser {
    width: clamp(320px, 28vw, 388px);
    background:
        linear-gradient(180deg, rgba(33, 36, 43, 0.95), rgba(19, 21, 26, 0.94));
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 24px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 22px 48px rgba(0, 0, 0, 0.22);
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.browser-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.browser-label {
    font-size: 11px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #8f98a3;
    margin-bottom: 8px;
}

.browser-header h2 {
    color: #e0e0e0;
    font-size: 22px;
    line-height: 1.1;
    max-width: 220px;
}

.source-overview {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 18px;
}

.source-summary {
    padding: 14px 16px;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.025));
    color: #bcc2ca;
    line-height: 1.45;
    font-size: 13px;
    overflow-wrap: anywhere;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.source-profile-summary {
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: #9ea6af;
    line-height: 1.4;
    font-size: 12px;
    overflow-wrap: anywhere;
}

.sidebar-section-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.sidebar-section-header-tight {
    margin-top: 18px;
}

.sidebar-section-eyebrow {
    font-size: 11px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #e8bc6a;
    margin-bottom: 6px;
}

.sidebar-section-copy {
    color: #8f98a3;
    font-size: 12px;
    line-height: 1.45;
}

.browser-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.browser-controls label {
    font-size: 12px;
    color: #c7c7c7;
}

#origin-select,
#path-input,
#local-path-input,
#bunny-path-input,
#bunny-api-base-input,
#bunny-storage-zone-input,
#bunny-api-key-input,
#aws-path-input,
#custom-path-input,
#custom-api-base-input,
#auth-token-input {
    padding: 10px 12px;
    border: 1px solid #444;
    border-radius: 4px;
    background-color: #333;
    color: #fff;
    font-size: 14px;
    width: 100%;
}

.source-fields {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

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

.auth-panel {
    border: 1px solid #3e3e3e;
    border-radius: 6px;
    padding: 12px;
    background: #242424;
}

.inline-auth-panel {
    margin-top: 4px;
}

.auth-panel summary {
    cursor: pointer;
    color: #d9d9d9;
    font-size: 13px;
    margin-bottom: 10px;
}

.checkbox-line {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: #bbb;
    margin-top: 2px;
}

.auth-buttons {
    display: flex;
    gap: 10px;
}

#save-token-btn,
#clear-token-btn {
    flex: 1;
    padding: 9px 10px;
    background-color: #3b73a5;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

#clear-token-btn {
    background-color: #5e3d3d;
}

#save-token-btn:hover {
    background-color: #2f5d85;
}

#clear-token-btn:hover {
    background-color: #4b3232;
}

.auth-token-status {
    font-size: 12px;
    color: #8ec5ff;
    min-height: 16px;
    margin-top: 2px;
}

.auth-help {
    font-size: 11px;
    color: #9e9e9e;
    line-height: 1.4;
    margin-top: 2px;
}

#bucket-input {
    padding: 8px 12px;
    border: 1px solid #444;
    border-radius: 4px;
    background-color: #333;
    color: #fff;
    font-size: 14px;
}

#load-buckets-btn {
    padding: 8px 16px;
    background-color: #007acc;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

#load-buckets-btn:hover {
    background-color: #005a9e;
}

.breadcrumb-nav {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    min-width: 0;
    max-height: 210px;
    overflow-y: auto;
    scrollbar-width: thin;
    padding-right: 4px;
}

.breadcrumb-item {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    min-width: 0;
    padding: 9px 12px;
    padding-left: calc(12px + (var(--crumb-depth, 0) * 12px));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    color: #c9d8e9;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, transform 0.18s ease;
}

.breadcrumb-item:hover {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: rgba(232, 188, 106, 0.36);
    transform: translateY(-1px);
}

.breadcrumb-item.active {
    color: #1c1f24;
    font-weight: 600;
    cursor: default;
    background: #e8bc6a;
    border-color: transparent;
}

.breadcrumb-item.active:hover {
    background: #e8bc6a;
    transform: none;
}

.breadcrumb-item-label,
.breadcrumb-item-path {
    width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.breadcrumb-item-label {
    font-size: 13px;
    font-weight: 650;
    letter-spacing: 0.02em;
}

.breadcrumb-item-path {
    font-size: 11px;
    color: #8f98a3;
}

.breadcrumb-item.active .breadcrumb-item-path {
    color: rgba(22, 25, 30, 0.72);
}

.breadcrumb-shell {
    padding: 12px 14px 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.folder-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
}

.folder-list-shell {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: rgba(14, 16, 21, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.folder-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    cursor: pointer;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.03);
    transition: background-color 0.2s, border-color 0.2s, transform 0.18s ease;
    text-align: left;
    color: #eef3f8;
}

.folder-item:hover {
    background-color: rgba(255, 255, 255, 0.06);
    border-color: rgba(232, 188, 106, 0.22);
    transform: translateY(-1px);
}

.folder-item.selected {
    background: rgba(48, 79, 104, 0.72);
    border-color: rgba(142, 197, 255, 0.42);
}

.folder-item.current-folder {
    background: linear-gradient(135deg, rgba(88, 168, 110, 0.28), rgba(50, 119, 76, 0.42));
    border-color: rgba(118, 205, 144, 0.34);
}

.folder-item-icon,
.folder-item-trailing {
    flex: 0 0 auto;
    color: #e8bc6a;
    font-size: 15px;
}

.folder-item-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
}

.folder-item-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 600;
    color: #edf2f7;
}

.folder-item-meta {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #8f98a3;
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.current-folder-badge {
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: #f6fbff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.loading {
    text-align: center;
    color: #98a3ae;
    padding: 28px 20px;
    line-height: 1.5;
    border: 1px dashed rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.02);
}

/* Viewer Container */
.viewer-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-width: 0; /* Allow flex item to shrink */
}



/* Responsive Design */
@media (max-width: 1200px) {
    .app-container {
        flex-direction: column;
        height: auto;
        overflow-y: auto;
        gap: 18px;
    }
    
    .aws-browser {
        width: 100%;
        height: 280px;
    }
    
    .viewer-container {
        height: calc(100vh - 240px);
    }
}

@media (max-width: 768px) {
    .app-container {
        padding: 14px;
        gap: 14px;
    }

    .connection-overlay {
        padding: 14px;
        align-items: stretch;
    }

    .connection-card {
        padding: 20px;
        border-radius: 20px;
    }

    .connection-grid {
        grid-template-columns: 1fr;
    }

    .connection-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .action-buttons {
        justify-content: stretch;
    }

    .action-buttons button {
        width: 100%;
    }
    
    .aws-browser {
        height: 220px;
    }
    
    .timeline-container {
        height: 150px;
        padding: 15px;
    }
} 