/* AWS Cloudscape Design System - Following official guidelines */
/* Reference: https://cloudscape.aws.dev/foundation/visual-foundation/ */

:root {
    /* AWS Brand Colors */
    --aws-squid-ink: #232f3e;
    --aws-orange: #ff9900;
    
    /* Cloudscape Design Tokens - Comfortable Mode (Standard) */
    --space-xxxs: 4px;
    --space-xxs: 8px;
    --space-xs: 12px;
    --space-s: 16px;
    --space-m: 20px;
    --space-l: 24px;
    --space-xl: 32px;
    --space-xxl: 40px;
    
    /* Typography - Amazon Ember */
    --font-family-base: "Amazon Ember", "Helvetica Neue", Roboto, Arial, sans-serif;
    --font-size-body-s: 12px;
    --font-size-body-m: 14px;
    --font-size-heading-xs: 14px;
    --font-size-heading-s: 16px;
    --font-size-heading-m: 18px;
    --font-size-heading-l: 20px;
    --font-size-heading-xl: 24px;
    
    /* Line Heights */
    --line-height-body-s: 16px;
    --line-height-body-m: 20px;
    --line-height-heading-xs: 18px;
    --line-height-heading-s: 20px;
    --line-height-heading-m: 22px;
    --line-height-heading-l: 24px;
    --line-height-heading-xl: 30px;
    
    /* Light Mode Colors - Cloudscape Design Tokens */
    --color-text-body-default: #16191f;
    --color-text-body-secondary: #5f6b7a;
    --color-text-disabled: #9ba7b6;
    --color-text-link-default: #0972d3;
    --color-text-status-success: #037f0c;
    --color-text-status-info: #0972d3;
    --color-text-status-warning: #8d6605;
    --color-text-status-error: #d91515;
    
    --color-background-container-content: #ffffff;
    --color-background-container-header: #f9fafb;
    --color-background-layout-main: #f2f3f3;
    
    /* Focus Colors */
    --color-border-focus: #0972d3;
}
    --color-background-control-default: #ffffff;
    --color-background-item-selected: #e1f5fe;
    
    --color-border-divider-default: #e9ebed;
    --color-border-control-default: #d5dbdb;
    --color-border-item-selected: #0972d3;
    
    --color-shadow-default: rgba(0, 28, 36, 0.3);
    --color-shadow-medium: rgba(0, 28, 36, 0.15);
}

/* Dark Mode Colors - Cloudscape Design Tokens */
body.dark-mode {
    --color-text-body-default: #ffffff;
    --color-text-body-secondary: #aab7b8;
    --color-text-disabled: #687078;
    --color-text-link-default: #539fe5;
    --color-text-status-success: #1d8102;
    --color-text-status-info: #539fe5;
    --color-text-status-warning: #f89256;
    --color-text-status-error: #ff5d64;
    
    --color-background-container-content: #16191f;
    --color-background-container-header: #0f1b2a;
    --color-background-layout-main: #0f1b2a;
    --color-background-control-default: #16191f;
    --color-background-item-selected: #1a2332;
    
    --color-border-divider-default: #414d5c;
    --color-border-control-default: #414d5c;
    --color-border-item-selected: #539fe5;
    
    --color-shadow-default: rgba(0, 0, 0, 0.5);
    --color-shadow-medium: rgba(0, 0, 0, 0.3);
}

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

html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
}

body {
    font-family: var(--font-family-base);
    font-size: var(--font-size-body-m);
    line-height: var(--line-height-body-m);
    color: var(--color-text-body-default);
    background-color: var(--color-background-layout-main);
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    transition: background-color 0.3s ease;
    /* Comfortable mode - standard spacing */
    letter-spacing: normal;
}



#app {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    position: relative;
}

/* AWS Console Top Navigation */
.aws-top-nav {
    background-color: var(--aws-squid-ink);
    color: white;
    height: 48px;
    box-shadow: 0 1px 1px 0 rgba(0, 28, 36, 0.3);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1000;
    margin: 0;
}

/* Search input placeholder color */
.aws-top-nav input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.aws-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 600;
}

.aws-logo-icon {
    width: 32px;
    height: 32px;
    background: var(--aws-orange);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
}

.aws-user-info {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
}

/* Layout Container */
.aws-layout {
    position: absolute;
    top: 48px;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: calc(100vh - 48px);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: row;
}

/* Left Sidebar Navigation */
.aws-sidebar {
    width: 280px;
    height: 100%;
    background: var(--color-background-container-content);
    border-right: 1px solid var(--color-border-divider-default);
    overflow-y: auto;
    overflow-x: hidden;
    flex-shrink: 0;
    position: relative;
    margin: 0;
    padding: 0;
    transition: width 0.3s ease, background 0.3s ease, border-color 0.3s ease;
    
    /* Hide scrollbar but keep functionality - AWS Console style */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

/* Hide scrollbar for Chrome, Safari and Opera */
.aws-sidebar::-webkit-scrollbar {
    display: none;
}

.aws-sidebar.collapsed {
    width: 48px;
}

.aws-sidebar.collapsed .sidebar-header h2,
.aws-sidebar.collapsed .sidebar-action-buttons,
.aws-sidebar.collapsed .nav-section-title span:not(.nav-section-icon),
.aws-sidebar.collapsed .nav-section-count,
.aws-sidebar.collapsed .nav-section-toggle,
.aws-sidebar.collapsed .nav-section-items {
    display: none !important;
}

.aws-sidebar.collapsed .nav-section-header {
    justify-content: center;
    padding: 12px 8px;
}

.aws-sidebar.collapsed .nav-section-icon {
    font-size: 20px;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--color-border-divider-default);
    background: var(--color-background-container-content);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.sidebar-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text-body-default);
    margin: 0;
    transition: color 0.3s ease;
}

.sidebar-nav {
    padding: 8px 0;
    margin: 0;
}

.nav-section {
    margin-bottom: 4px;
}

.nav-section-header {
    padding: 10px 12px;
    margin: 4px 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s;
    user-select: none;
    border-radius: 8px;
}

.nav-section-header:hover {
    background: var(--color-background-container-header);
}

.nav-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-body-default);
    transition: color 0.3s ease;
}

.nav-section-icon {
    font-size: 18px;
}

.nav-section-count {
    font-size: 12px;
    color: var(--color-text-body-secondary);
    background: var(--color-background-container-header);
    padding: 2px 8px;
    border-radius: 12px;
    transition: background 0.3s ease, color 0.3s ease;
}

.nav-section-toggle {
    font-size: 12px;
    color: var(--color-text-body-secondary);
    transition: transform 0.2s, color 0.3s ease;
}

.nav-section-toggle.expanded {
    transform: rotate(90deg);
}

.nav-section-items {
    display: none;
    padding: 4px 0;
    background: transparent;
    transition: background 0.3s ease;
}

.nav-section-items.expanded {
    display: block;
}

.nav-item {
    padding: 8px 12px 8px 48px;
    margin: 2px 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--color-text-body-secondary);
    transition: all 0.15s ease;
    border-radius: 8px;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: var(--color-background-container-header);
    color: var(--color-text-body-default);
    border-left-color: var(--color-border-divider-default);
}

.nav-item.active {
    background: var(--color-background-item-selected);
    color: var(--color-text-link-default);
    border-left-color: var(--color-border-item-selected);
    font-weight: 600;
}

/* Tree View Styles */
.nav-item-tree {
    margin: 0;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.nav-item-tree.expanded {
    background: var(--color-background-container-header);
    box-shadow: inset 0 0 0 1px var(--color-border-divider-default);
}

.nav-item-parent {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-item-parent .nav-item {
    flex: 1;
    margin: 0;
    padding-left: 8px;
}

.nav-item-children {
    margin-left: 20px;
    border-left: 2px solid var(--color-border-item-selected);
    padding-left: 8px;
    margin-top: 4px;
    padding-bottom: 4px;
    background: rgba(9, 114, 211, 0.05);
}

.nav-item-child {
    padding-left: 16px;
    font-size: 12px;
    background: white;
    margin: 2px 0;
    border-radius: 4px;
}

.nav-item-child:hover {
    background: var(--color-background-container-header);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.tree-toggle {
    transition: transform 0.2s ease;
}

/* Main Content Area */
.aws-main-content {
    flex: 1;
    height: 100%;
    overflow-y: auto;
    padding: 24px;
    background: var(--color-background-layout-main);
    margin: 0;
    position: relative;
    transition: margin-left 0.3s ease, background 0.3s ease;
    
    /* Hide scrollbar but keep functionality - AWS Console style */
    scrollbar-width: thin; /* Firefox - thin scrollbar */
    scrollbar-color: var(--color-border-control-default) transparent; /* Firefox */
}

/* Thin scrollbar for Chrome, Safari and Opera */
.aws-main-content::-webkit-scrollbar {
    width: 8px;
}

.aws-main-content::-webkit-scrollbar-track {
    background: transparent;
}

.aws-main-content::-webkit-scrollbar-thumb {
    background: var(--color-border-control-default);
    border-radius: 4px;
}

.aws-main-content::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-body-secondary);
}

/* Service Header */
/* Service Header - Cloudscape Comfortable Mode */
.service-header {
    background: var(--color-background-container-content);
    padding: var(--space-l);
    margin-bottom: var(--space-l);
    border-radius: 8px;
    box-shadow: 0 1px 1px 0 rgba(0, 28, 36, 0.3), 
                1px 1px 1px 0 rgba(0, 28, 36, 0.15), 
                -1px 1px 1px 0 rgba(0, 28, 36, 0.15);
}

.service-header h1 {
    font-size: var(--font-size-heading-xl);
    line-height: var(--line-height-heading-xl);
    font-weight: 700;
    color: var(--color-text-body-default);
    margin-bottom: var(--space-xxs);
}

.service-header p {
    color: var(--color-text-body-secondary);
    font-size: var(--font-size-body-m);
    line-height: var(--line-height-body-m);
}

.creator-info {
    margin-top: var(--space-xs);
    padding-top: var(--space-xs);
    border-top: 1px solid var(--color-border-divider-default);
    font-size: var(--font-size-body-s);
    line-height: var(--line-height-body-s);
    color: var(--color-text-body-secondary);
}

.creator-link {
    color: var(--aws-orange);
    text-decoration: none;
}

.creator-link:hover {
    text-decoration: underline;
}

/* Search Container - Cloudscape Comfortable Mode */
.search-section {
    background: var(--color-background-container-content);
    padding: var(--space-m) var(--space-l);
    margin-bottom: var(--space-l);
    border-radius: 8px;
    box-shadow: 0 1px 1px 0 rgba(0, 28, 36, 0.3), 
                1px 1px 1px 0 rgba(0, 28, 36, 0.15), 
                -1px 1px 1px 0 rgba(0, 28, 36, 0.15);
}

/* Breadcrumb */
.breadcrumb-section {
    margin-bottom: var(--space-s);
}

/* Cards Container - Cloudscape Comfortable Mode */
.cards-container {
    background: var(--color-background-container-content);
    padding: var(--space-l);
    border-radius: 8px;
    box-shadow: 0 1px 1px 0 rgba(0, 28, 36, 0.3), 
                1px 1px 1px 0 rgba(0, 28, 36, 0.15), 
                -1px 1px 1px 0 rgba(0, 28, 36, 0.15);
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-s);
}

/* Domain Card */
.domain-card-cloudscape {
    background: var(--color-background-container-content);
    border: 1px solid var(--color-border-control-default);
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.domain-card-cloudscape:hover {
    border-color: var(--aws-orange);
    box-shadow: 0 4px 8px var(--color-shadow-medium);
    transform: translateY(-2px);
}

.domain-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.domain-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text-body-default);
    margin-bottom: 8px;
    transition: color 0.3s ease;
}

.domain-description {
    font-size: 14px;
    color: var(--color-text-body-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
    transition: color 0.3s ease;
}

.service-count {
    font-size: 13px;
    color: var(--aws-orange);
    font-weight: 500;
}

/* Service Detail Card */
.service-detail-card {
    background: var(--color-background-container-content);
    border: 1px solid var(--color-border-control-default);
    border-radius: 8px;
    padding: 0;
    margin-bottom: 16px;
    transition: background 0.3s ease, border-color 0.3s ease;
    overflow: hidden;
}

.service-card-header {
    transition: background 0.3s ease;
}

.service-card-body {
    background: var(--color-background-container-content);
    transition: background 0.3s ease;
}

.service-domain-badge {
    background: rgba(255,255,255,0.95);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

body.dark-mode .service-domain-badge {
    background: rgba(22,25,31,0.95);
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.service-icon-container {
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

body.dark-mode .service-icon-container {
    background: var(--color-background-container-content);
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.service-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.service-name {
    font-size: 24px;
    font-weight: 400;
    color: var(--color-text-body-default);
    transition: color 0.3s ease;
}

.service-links {
    display: flex;
    gap: 8px;
}

.service-description {
    color: var(--color-text-body-secondary);
    line-height: 1.6;
    margin-bottom: 20px;
    transition: color 0.3s ease;
}

/* Section Styling */
.service-section {
    margin-bottom: 20px;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text-body-default);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--color-border-divider-default);
    transition: color 0.3s ease, border-color 0.3s ease;
}

.service-section ul {
    list-style: none;
    padding: 0;
}

.service-section li {
    padding: 6px 0;
    color: var(--color-text-body-secondary);
    padding-left: 20px;
    position: relative;
    transition: color 0.3s ease;
}

.service-section li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--aws-orange);
    font-weight: bold;
}

/* Integration Tags */
.integration-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.integration-tag {
    background: var(--color-background-container-header);
    color: var(--color-text-body-default);
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 13px;
    border: 1px solid var(--color-border-control-default);
    transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Alert Boxes */
.alert-box {
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    border-left: 4px solid;
}

.alert-info {
    background: #f1f9ff;
    border-left-color: #0972d3;
    color: #0972d3;
}

.alert-warning {
    background: #fffbf0;
    border-left-color: #ff9900;
    color: #8d6605;
}

.alert-success {
    background: #f2f8f0;
    border-left-color: #037f0c;
    color: #037f0c;
}

.alert-error {
    background: #fff5f5;
    border-left-color: #d91515;
    color: #d91515;
}

/* Pricing Section */
.pricing-section {
    background: #f1f9ff;
    padding: 16px;
    border-radius: 8px;
    border-left: 4px solid #0972d3;
}

.pricing-text {
    color: #16191f;
    line-height: 1.6;
    margin-bottom: 12px;
}

/* Competitive Section */
.competitive-section {
    background: #fffbf0;
    padding: 16px;
    border-radius: 8px;
    border-left: 4px solid #ff9900;
}

/* Discovery Questions */
.discovery-section {
    background: #f2f8f0;
    padding: 16px;
    border-radius: 8px;
    border-left: 4px solid #037f0c;
}

/* Objection Handling */
.objection-section {
    background: #fff5f5;
    padding: 16px;
    border-radius: 8px;
    border-left: 4px solid #d91515;
}

.objection-item {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.objection-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.objection-text {
    font-weight: 600;
    color: #d91515;
    margin-bottom: 6px;
}

.response-text {
    color: #16191f;
    line-height: 1.5;
}

/* Buttons - Cloudscape Design System */
.btn-primary {
    background: var(--aws-orange);
    color: white;
    border: none;
    padding: var(--space-xxs) var(--space-s);
    border-radius: 6px;
    font-family: var(--font-family-base);
    font-size: var(--font-size-body-m);
    line-height: var(--line-height-body-m);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #ec7211;
}

.btn-primary:focus {
    outline: 2px solid #0972d3;
    outline-offset: 2px;
}

.btn-secondary {
    background: var(--color-background-container-content);
    color: var(--color-text-body-default);
    border: 1px solid #d5dbdb;
    padding: var(--space-xxs) var(--space-s);
    border-radius: 6px;
    font-family: var(--font-family-base);
    font-size: var(--font-size-body-m);
    line-height: var(--line-height-body-m);
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #f2f3f3;
    border-color: #aab7b8;
}

.btn-secondary:focus {
    outline: 2px solid #0972d3;
    outline-offset: 2px;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 40px;
    color: #5f6b7a;
}

/* Sidebar Toggle Button (Mobile) */
.sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: var(--aws-orange);
    color: white;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 999;
}

/* Responsive */
@media (max-width: 768px) {
    .aws-sidebar {
        position: fixed;
        left: -280px;
        top: 48px;
        height: calc(100vh - 48px);
        z-index: 998;
        transition: left 0.3s;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    }
    
    .aws-sidebar.mobile-open {
        left: 0;
    }
    
    .sidebar-toggle {
        display: block;
    }
    
    .aws-main-content {
        padding: 16px;
    }
    
    .cards-grid {
        grid-template-columns: 1fr;
    }
    
    .service-detail-header {
        flex-direction: column;
    }
    
    .service-links {
        width: 100%;
    }
}

/* Responsive styles for top navigation */
@media (max-width: 768px) {
    .aws-top-nav {
        flex-wrap: wrap;
        height: auto;
        padding: 8px 12px;
    }
    
    .aws-logo span:not([style*="background"]) {
        display: none;
    }
    
    .compare-text {
        display: none !important;
    }
    
    .aws-top-nav > div:nth-child(2) {
        order: 3;
        width: 100%;
        margin-top: 8px;
        max-width: 100% !important;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .aws-logo span:first-of-type {
        font-size: 14px;
    }
    
    .aws-top-nav > div:nth-child(2) {
        max-width: 400px !important;
    }
}

@media (min-width: 1200px) {
    .compare-text {
        display: inline !important;
    }
}


/* ============================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================ */

/* Screen Reader Only - Visually hidden but accessible to screen readers */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border-width: 0 !important;
    clip-path: inset(50%) !important;
}

/* Focus Indicators - WCAG 2.1 Compliant */
*:focus {
    outline: 2px solid var(--color-border-focus, #0972d3);
    outline-offset: 2px;
}

/* Remove outline for mouse users, keep for keyboard users */
*:focus:not(:focus-visible) {
    outline: none;
}

/* Visible focus for keyboard navigation */
*:focus-visible {
    outline: 2px solid var(--color-border-focus, #0972d3);
    outline-offset: 2px;
}

/* Button focus styles */
button:focus-visible,
.btn-primary:focus-visible,
.btn-secondary:focus-visible {
    outline: 2px solid var(--color-border-focus, #0972d3);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(9, 114, 211, 0.1);
}

/* Input focus styles */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--color-border-focus, #0972d3);
    outline-offset: 0;
    border-color: var(--color-border-focus, #0972d3);
}

/* Link focus styles */
a:focus-visible {
    outline: 2px solid var(--color-border-focus, #0972d3);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Interactive div/span focus styles */
[role="button"]:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--color-border-focus, #0972d3);
    outline-offset: 2px;
}

/* Skip to main content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--aws-orange);
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    font-weight: 600;
    z-index: 10000;
    border-radius: 0 0 4px 0;
}

.skip-link:focus {
    top: 0;
}

/* Ensure sufficient color contrast for disabled states */
button:disabled,
input:disabled,
select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    *:focus-visible {
        outline-width: 3px;
        outline-offset: 3px;
    }
}

/* 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;
        scroll-behavior: auto !important;
    }
}
