:root {
    /* Sinch Brand Colors - Unified from Dashboard (Correct Colors) */
    --sinch-primary: #FFBE3C;        /* Sinch yellow for primary actions (255, 190, 60) */
    --sinch-primary-dark: #E6A834;   /* Darker yellow for hover states */
    --sinch-blue: #3089F0;           /* Sinch blue for accents */
    --sinch-nav-bg: #1e2532;         /* Dark blue navigation background */
    --sinch-hero-bg: #3089F0;        /* Blue for hero sections */
    --sinch-hero-bg-dark: #2570d6;   /* Darker blue for hero gradients */
    --sinch-sidebar-bg: #f8f9fa;     /* Light gray sidebar */
    --sinch-border: #e9ecef;         /* Light border color */
    --sinch-text-muted: #6c757d;     /* Muted text */
    --sinch-success: #28a745;
    --sinch-warning: #ffc107;
    --sinch-danger: #dc3545;
    
    /* Override Bootstrap CSS Variables */
    --bs-primary: var(--sinch-primary);
    --bs-primary-rgb: 255, 190, 60;  /* #FFBE3C in RGB (255, 190, 60) */
    --bs-warning: var(--sinch-primary);
}

/* Base Styles */
body {
    background-color: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 0;
}

/* Navigation */
.navbar {
    height: 64px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    z-index: 1030;
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 600;
    color: #333 !important;
    display: flex;
    align-items: center;
}

.navbar-brand svg {
    margin-right: 0.5rem;
}

.project-icon {
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #FF6B35, #F7931E);
    color: white;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

/* Sidebar (Dashboard) */
.sidebar {
    position: fixed;
    top: 64px;
    left: 0;
    width: 240px;
    height: calc(100vh - 64px);
    background-color: var(--sinch-sidebar-bg);
    border-right: 1px solid var(--sinch-border);
    overflow-y: auto;
    padding: 1rem 0;
    z-index: 1020;
}

.sidebar-nav {
    padding: 0;
}

.sidebar-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: #333;
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.sidebar-item:hover {
    background-color: #e9ecef;
    color: #333;
    text-decoration: none;
}

.sidebar-item.active {
    background-color: #e3f2fd;
    color: var(--sinch-blue);
    border-right: 3px solid var(--sinch-blue);
}

.sidebar-item i {
    width: 20px;
    margin-right: 0.75rem;
    font-size: 1rem;
}

.sidebar-section {
    margin-bottom: 0.5rem;
}

.sidebar-section-header {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--sinch-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
}

.sidebar-section-header:hover {
    color: #333;
}

.sidebar-section-header .chevron {
    margin-right: 0.5rem;
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}

.sidebar-section.expanded .chevron {
    transform: rotate(90deg);
}

.sidebar-sub-item {
    padding-left: 2.5rem;
    font-size: 0.875rem;
}

.sidebar-section:not(.expanded) .sidebar-sub-item {
    display: none;
}

/* Main Content */
.main-content {
    margin-left: 240px;
    margin-top: 64px;
    padding: 2rem;
    min-height: calc(100vh - 64px);
}

/* Page Header */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
}

.page-header .lead {
    color: var(--sinch-text-muted);
    font-size: 1.1rem;
}

/* Hero Section (Marketplace) */
.hero-section {
    background: linear-gradient(135deg, var(--sinch-hero-bg) 0%, var(--sinch-hero-bg-dark) 100%);
    color: white;
    padding: 3rem 0;
    margin-bottom: 2rem;
}

.hero-section h1 {
    font-size: 2.5rem;
    font-weight: 700;
}

.hero-section .lead {
    font-size: 1.25rem;
    opacity: 0.9;
}

/* Cards (Shared between Dashboard & Marketplace) */
.template-card {
    transition: all 0.2s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--sinch-border);
}

.template-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.template-card .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.template-actions {
    margin-top: auto;
    padding-top: 1rem;
}

/* Runtime Badges */
.runtime-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

.runtime-node { background-color: #f0f8e8; color: #2d5a27; }
.runtime-nodejs { background-color: #f0f8e8; color: #2d5a27; }
.runtime-nodejs20 { background-color: #f0f8e8; color: #2d5a27; }
.runtime-csharp { background-color: #f0f4ff; color: #1a365d; }
.runtime-python { background-color: #fef5e7; color: #744210; }

.difficulty-beginner { background-color: #d4edda; color: #155724; }
.difficulty-intermediate { background-color: #fff3cd; color: #856404; }
.difficulty-advanced { background-color: #f8d7da; color: #721c24; }

/* Status Badges (Dashboard) */
.status-running { background-color: #28a745; color: white; }
.status-stopped { background-color: #ffc107; color: #333; }
.status-failed { background-color: #dc3545; color: white; }
.status-deploying { background-color: var(--sinch-blue); color: white; }
.status-building { background-color: var(--sinch-blue); color: white; }

.feature-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
}

.feature-tag {
    background-color: #e9ecef;
    color: #495057;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
}

/* Search and Filters */
.search-filters {
    background-color: #f8f9fa;
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 2rem;
    border: 1px solid var(--sinch-border);
}

/* Buttons - Unified Sinch Yellow */
.btn-primary {
    background-color: var(--sinch-primary);
    border-color: var(--sinch-primary);
    color: #333;
    font-weight: 500;
}

.btn-primary:hover {
    background-color: var(--sinch-primary-dark);
    border-color: var(--sinch-primary-dark);
    color: #333;
}

.btn-primary:focus {
    box-shadow: 0 0 0 0.2rem rgba(255, 190, 60, 0.25);
}

.btn-warning {
    background-color: var(--sinch-primary);
    border-color: var(--sinch-primary);
    color: #333;
    font-weight: 500;
}

.btn-warning:hover {
    background-color: var(--sinch-primary-dark);
    border-color: var(--sinch-primary-dark);
    color: #333;
}

/* Badge Colors */
.badge.bg-primary {
    background-color: var(--sinch-blue) !important;
}

/* Code Preview and Steps */
.code-preview {
    background-color: #f8f9fa;
    border-radius: 0.375rem;
    padding: 1rem;
}

.code-preview pre {
    background-color: #212529;
    color: #f8f9fa;
    padding: 1rem;
    border-radius: 0.375rem;
    margin: 0;
    font-size: 0.875rem;
    overflow-x: auto;
}

.deployment-steps .step {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: flex-start;
}
/* Override Prism.js text shadows */
code[class*=language-], 
pre[class*=language-],
.token {
    text-shadow: none !important;
}

/* Function Detail Page Styles */
.function-header {
    background: white;
    border-bottom: 1px solid #dee2e6;
    padding: 16px 24px;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin: -2rem -2rem 0 -2rem;
}

.function-header .function-info h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: #212529;
}

.function-header .function-meta {
    color: #6c757d;
    font-size: 14px;
    margin-top: 4px;
}

.function-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.function-status.running {
    background: #d1f2d6;
    color: #0f5132;
}

.function-status.stopped {
    background: #fff3cd;
    color: #664d03;
}

.function-status.failed {
    background: #f8d7da;
    color: #721c24;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.nav-tabs {
    border-bottom: 2px solid #e9ecef;
    margin-top: 16px;
}

.nav-tabs .nav-link {
    border: none;
    color: #6c757d;
    font-weight: 500;
    padding: 12px 20px;
    margin-bottom: -2px;
}

.nav-tabs .nav-link.active {
    color: #0969da;
    border-bottom: 2px solid #0969da;
    background: none;
}

.nav-tabs .nav-link:hover {
    color: #0969da;
    border-color: transparent;
}

.tab-content {
    padding: 24px;
    margin: 0 auto;
    max-width: 100%;
}

/* Request/Logs styles */
.logs-controls {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.mode-toggle {
    display: inline-flex;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    background: #f8f9fa;
}

.mode-toggle input[type="radio"] {
    display: none;
}

.mode-toggle label {
    padding: 10px 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #6c757d;
    margin: 0;
    transition: all 0.3s ease;
    flex: 0 0 auto;
    white-space: nowrap;
    position: relative;
}

.mode-toggle label:hover {
    background: rgba(255, 255, 255, 0.5);
    color: #495057;
}

.mode-toggle input[type="radio"]:checked + label {
    background: white;
    color: #0969da;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: scale(1.02);
}

.requests-container {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    min-height: 400px;
}

.request-item {
    border-bottom: 1px solid #f1f3f4;
    transition: all 0.2s ease;
}

.request-item:last-child {
    border-bottom: none;
}

.request-item:hover {
    background: #f8f9fa;
}

.request-item.expanded .expand-icon {
    transform: rotate(90deg);
}

.request-summary {
    padding: 16px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.request-main {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.http-method {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    min-width: 48px;
    text-align: center;
}

.http-method.get { background: #d1ecf1; color: #0c5460; }
.http-method.post { background: #d4edda; color: #155724; }
.http-method.put { background: #fff3cd; color: #856404; }
.http-method.delete { background: #f8d7da; color: #721c24; }
.http-method.patch { background: #e2e3e5; color: #383d41; }

.request-url {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 13px;
    color: #24292f;
}

.request-info {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    color: #656d76;
    min-width: 450px;
    justify-content: flex-end;
}

.status-code {
    font-family: 'Monaco', 'Menlo', monospace;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
}

.status-code.success { background: #d4edda; color: #155724; }
.status-code.redirect { background: #fff3cd; color: #856404; }
.status-code.error { background: #f8d7da; color: #721c24; }

.expand-icon {
    transition: transform 0.2s ease;
    color: #656d76;
}

.request-details {
    display: none;
    border-top: 1px solid #f1f3f4;
    background: #fafbfc;
}

.request-item.expanded .request-details {
    display: block;
}

.details-tabs {
    display: flex;
    border-bottom: 1px solid #e1e4e8;
    background: white;
    padding: 0 20px;
}

.details-tab {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    font-size: 13px;
    font-weight: 500;
    color: #656d76;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.details-tab:hover {
    color: #24292f;
    background: #f6f8fa;
}

.details-tab.active {
    color: #0969da;
    border-bottom-color: #0969da;
    background: white;
}

.details-content {
    padding: 20px;
}

.details-section {
    display: none;
}

.details-section.active {
    display: block;
}

.request-response-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 768px) {
    .request-response-grid {
        grid-template-columns: 1fr;
    }
}

.code-block {
    background: #f6f8fa;
    border: 1px solid #d1d9e0;
    border-radius: 6px;
    margin-bottom: 16px;
}

.code-block * {
    text-shadow: none !important;
}

.code-header {
    background: #f1f3f4;
    padding: 8px 12px;
    border-bottom: 1px solid #d1d9e0;
    font-size: 12px;
    font-weight: 600;
    color: #24292f;
    display: flex;
    align-items: center;
    gap: 6px;
}

.code-content {
    padding: 12px;
}

.code-content pre {
    margin: 0;
    font-size: 12px;
    line-height: 1.4;
    background: none;
    border: none;
    padding: 0;
}

.headers-list {
    background: #f6f8fa;
    border: 1px solid #d1d9e0;
    border-radius: 6px;
    padding: 12px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 12px;
}

.logs-section {
    background: #0d1117;
    border-radius: 6px;
    overflow: hidden;
}

.logs-header {
    background: #21262d;
    padding: 12px 16px;
    border-bottom: 1px solid #30363d;
}

.logs-header h6 {
    color: #f0f6fc;
    margin: 0;
    font-size: 13px;
}

.console-logs {
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;
}

.log-entry {
    margin-bottom: 8px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 12px;
    display: flex;
    gap: 12px;
}

.log-timestamp {
    color: #7d8590;
    min-width: 80px;
}

.log-level {
    min-width: 50px;
    font-weight: 600;
}

.log-level.info { color: #58a6ff; }
.log-level.warning { color: #f85149; }
.log-level.error { color: #f85149; }
.log-level.debug { color: #79c0ff; }

.log-message {
    color: #e6edf3;
    flex: 1;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #656d76;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h5 {
    margin-bottom: 8px;
    color: #24292f;
}

/* Real-time indicator */
.realtime-indicator {
    display: none;
    align-items: center;
    gap: 8px;
    color: #28a745;
    font-size: 14px;
    font-weight: 600;
    background: rgba(40, 167, 69, 0.1);
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid rgba(40, 167, 69, 0.2);
}

.realtime-indicator.active {
    display: inline-flex;
}

.pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #28a745;
    animation: pulse 1.5s infinite;
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.2);
}

@keyframes pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
    100% { opacity: 1; transform: scale(1); }
}

/* Metrics Dashboard Styles */
.metrics-dashboard .card {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border: 1px solid #e3e6f0;
}

.metrics-dashboard .card-header {
    background: #f8f9fc;
    border-bottom: 1px solid #e3e6f0;
    font-weight: 600;
}

.metric-stat {
    padding: 20px 0;
}

.metric-value {
    font-size: 2rem;
    font-weight: bold;
    color: #5a5c69;
    margin-bottom: 5px;
}

.metric-label {
    font-size: 0.875rem;
    color: #858796;
    text-transform: uppercase;
    font-weight: 600;
}

.metric-trend {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.metric-trend.positive {
    color: #28a745;
}

.metric-trend.negative {
    color: #dc3545;
}

.metric-trend.neutral {
    color: #6c757d;
}

.insights-container {
    min-height: 120px;
}

.insight-item {
    padding: 12px 16px;
    margin-bottom: 8px;
    border-radius: 6px;
    border-left: 4px solid;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    gap: 12px;
}

.insight-item.good {
    border-left-color: #28a745;
    background: rgba(40, 167, 69, 0.05);
}

.insight-item.warning {
    border-left-color: #ffc107;
    background: rgba(255, 193, 7, 0.05);
}

.insight-item.alert {
    border-left-color: #dc3545;
    background: rgba(220, 53, 69, 0.05);
}

.insight-icon {
    font-size: 1.2rem;
}

.insight-text {
    flex: 1;
    margin: 0;
    font-size: 0.9rem;
}
.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    background-color: var(--sinch-primary);
    color: #333;
    border-radius: 50%;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.code-block {
    position: relative;
    border-radius: 0.375rem;
}

.code-block pre {
    background-color: #2d3748 !important;
    border-radius: 0.375rem;
    margin: 0;
    padding: 1rem 2.5rem 1rem 1rem;
    font-size: 0.875rem;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

.code-block code {
    background: none !important;
    color: #e2e8f0 !important;
    padding: 0 !important;
}

.copy-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 0.25rem;
    border-radius: 0.25rem;
    cursor: pointer;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Loading States */
.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 190, 60, 0.3);
    border-radius: 50%;
    border-top-color: var(--sinch-primary);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Dashboard Specific Styles */
.dashboard-header {
    margin-bottom: 2rem;
}

.metric-card {
    background: white;
    border: 1px solid var(--sinch-border);
    border-radius: 0.5rem;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s ease;
    height: 100%;
}

.metric-card:hover {
    border-color: var(--sinch-primary);
    box-shadow: 0 2px 8px rgba(255, 190, 60, 0.1);
}

.metric-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 0.5rem;
    background-color: #f8f9fa;
    font-size: 1.5rem;
}

.metric-icon.bg-primary { background-color: rgba(255, 190, 60, 0.1); color: var(--sinch-primary); }
.metric-icon.bg-success { background-color: rgba(40, 167, 69, 0.1); color: var(--sinch-success); }
.metric-icon.bg-warning { background-color: rgba(255, 193, 7, 0.1); color: var(--sinch-warning); }
.metric-icon.bg-danger { background-color: rgba(220, 53, 69, 0.1); color: var(--sinch-danger); }
.metric-icon.bg-info { background-color: rgba(48, 137, 240, 0.1); color: var(--sinch-blue); }

/* Material Icons styling */
.material-icons {
    font-size: 24px;
    vertical-align: middle;
}

.metric-content { flex: 1; }
.metric-number { font-size: 2rem; font-weight: 600; margin: 0; color: #212529; }
.metric-label { color: var(--sinch-text-muted); margin: 0; font-size: 0.875rem; }

.auto-refresh-timer {
    font-size: 0.875rem;
    color: var(--sinch-text-muted);
}

.function-status {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.running { background-color: var(--sinch-success); }
.status-dot.stopped { background-color: var(--sinch-warning); }
.status-dot.failed { background-color: var(--sinch-danger); }
.status-dot.deploying { background-color: var(--sinch-blue); animation: pulse 2s infinite; }

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

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 1rem;
    }
    
    .navbar-toggler {
        display: block;
    }
    
    .hero-section h1 {
        font-size: 2rem;
    }
    
    .hero-section .lead {
        font-size: 1.1rem;
    }
    
    .template-card {
        margin-bottom: 1rem;
    }
}

@media (min-width: 769px) {
    .navbar-toggler {
        display: none;
    }
}