/* ============================================
   OnePlus1 API Documentation - Custom Styles
   Modern, Professional Design System
   ============================================ */

/* CSS Variables - Design Tokens */
:root {
    /* Colors - Primary */
    --color-primary: #6366f1;
    --color-primary-dark: #4f46e5;
    --color-primary-light: #818cf8;

    /* Colors - Accent */
    --color-accent: #8b5cf6;
    --color-accent-dark: #7c3aed;

    /* Colors - Neutrals */
    --color-dark: #0f172a;
    --color-dark-secondary: #1e293b;
    --color-gray-900: #0f172a;
    --color-gray-800: #1e293b;
    --color-gray-700: #334155;
    --color-gray-600: #475569;
    --color-gray-500: #64748b;
    --color-gray-400: #94a3b8;
    --color-gray-300: #cbd5e1;
    --color-gray-200: #e2e8f0;
    --color-gray-100: #f1f5f9;
    --color-gray-50: #f8fafc;

    /* Colors - Semantic */
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-error: #ef4444;
    --color-info: #3b82f6;

    /* Colors - HTTP Methods */
    --color-get: #10b981;
    --color-post: #3b82f6;
    --color-put: #f59e0b;
    --color-delete: #ef4444;
    --color-patch: #8b5cf6;

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    --spacing-3xl: 4rem;

    /* Typography */
    --font-family-base: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-family-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;

    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-base: 200ms ease-in-out;
    --transition-slow: 300ms ease-in-out;
}

/* ============================================
   Base Styles
   ============================================ */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family-base);
    font-size: 16px;
    line-height: 1.6;
    color: var(--color-gray-800);
    background: linear-gradient(135deg, #f8fafc 0%, #e0e7ff 100%);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

code {
    font-family: var(--font-family-mono);
    font-size: 0.875em;
    background: var(--color-gray-100);
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-sm);
    color: var(--color-primary-dark);
}

/* ============================================
   Header Navigation
   ============================================ */

.api-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: white;
    border-bottom: 1px solid var(--color-gray-200);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brand-logo {
    flex-shrink: 0;
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.brand-name {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--color-gray-900);
    letter-spacing: -0.02em;
}

.brand-version {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-gray-500);
    background: var(--color-gray-100);
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    width: fit-content;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-link {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--color-gray-700);
    text-decoration: none;
    transition: color var(--transition-fast);
    position: relative;
}

.nav-link:hover {
    color: var(--color-primary);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--color-primary);
    transform: scaleX(0);
    transition: transform var(--transition-base);
}

.nav-link:hover::after {
    transform: scaleX(1);
}

.nav-link-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: var(--color-gray-700);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-lg);
    font-size: 0.9375rem;
    font-weight: 600;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
}

.nav-link-secondary:hover {
    background: var(--color-gray-600);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.nav-link-download {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-lg);
    font-size: 0.9375rem;
    font-weight: 600;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-md);
}

.nav-link-download:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Hero section removed - using simple header for internal documentation */

/* ============================================
   Content Sections
   ============================================ */

.content-section {
    padding: 4rem 2rem;
}

.content-section:first-of-type {
    padding-top: 3rem;
}

.section-container {
    max-width: 1200px;
    margin: 0 auto;
}

.section-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-gray-900);
    margin: 0 0 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-icon {
    color: var(--color-primary);
    flex-shrink: 0;
}

.section-description {
    font-size: 1.125rem;
    color: var(--color-gray-600);
    margin: 0 0 2rem;
    line-height: 1.7;
}

/* ============================================
   Quick Start Cards
   ============================================ */

.quick-start-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.quick-start-card {
    background: white;
    border-radius: var(--radius-2xl);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
    border: 1px solid var(--color-gray-200);
    opacity: 0;
    transform: translateY(20px);
}

.quick-start-card.animate-in {
    opacity: 1;
    transform: translateY(0);
    animation: slideUp 0.5s ease-out forwards;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.quick-start-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
    border-color: var(--color-primary);
}

.card-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
    color: white;
    border-radius: 50%;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-gray-900);
    margin: 0 0 0.75rem;
}

.card-description {
    font-size: 0.9375rem;
    color: var(--color-gray-600);
    margin: 0;
    line-height: 1.6;
}

/* ============================================
   Authentication Section
   ============================================ */

.auth-section {
    background: white;
}

/* ============================================
   Code Examples
   ============================================ */

.code-examples {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border: 1px solid var(--color-gray-200);
    margin-top: 2rem;
    opacity: 0;
    transform: translateY(20px);
}

.code-examples.animate-in {
    opacity: 1;
    transform: translateY(0);
    animation: slideUp 0.5s ease-out forwards;
}

.code-tabs {
    display: flex;
    gap: 0.25rem;
    padding: 1rem 1rem 0;
    background: var(--color-gray-50);
    border-bottom: 1px solid var(--color-gray-200);
}

.code-tab {
    padding: 0.625rem 1.25rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-gray-600);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: var(--font-family-mono);
}

.code-tab:hover {
    background: var(--color-gray-100);
    color: var(--color-gray-900);
}

.code-tab.active {
    background: white;
    color: var(--color-primary);
    box-shadow: 0 -2px 0 0 var(--color-primary) inset;
}

.code-content {
    position: relative;
}

.code-block {
    display: none;
    position: relative;
}

.code-block.active {
    display: block;
}

.copy-button {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    background: var(--color-gray-800);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    z-index: 10;
}

.copy-button:hover {
    background: var(--color-gray-700);
    transform: translateY(-1px);
}

.copy-button.copied {
    background: var(--color-success);
}

.code-block pre {
    margin: 0;
    padding: 2.5rem 1.5rem 1.5rem;
    background: var(--color-gray-900);
    overflow-x: auto;
}

.code-block code {
    font-family: var(--font-family-mono);
    font-size: 0.875rem;
    line-height: 1.7;
    color: #e2e8f0;
    background: transparent;
    padding: 0;
}

/* ============================================
   Swagger UI Customization
   ============================================ */

#swagger-ui {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 2rem 4rem;
}

/* Hide default Swagger topbar */
#swagger-ui .topbar {
    display: none;
}

/* Information Container */
#swagger-ui .information-container {
    display: none; /* Hidden since we have custom hero/getting started */
}

/* Scheme Container */
#swagger-ui .scheme-container {
    background: white;
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    margin: 2rem 0;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-gray-200);
}

/* Operation Blocks */
#swagger-ui .opblock-tag-section {
    margin-bottom: 2rem;
}

#swagger-ui .opblock-tag {
    font-size: 1.5rem;
    font-weight: 700;
    padding: 1.5rem 0;
    margin: 0;
    color: var(--color-gray-900);
    border-bottom: 2px solid var(--color-gray-200);
}

#swagger-ui .opblock {
    border-radius: var(--radius-xl);
    border: 1px solid var(--color-gray-200);
    box-shadow: var(--shadow-md);
    margin: 1rem 0;
    background: white;
    transition: all var(--transition-base);
    overflow: hidden;
}

#swagger-ui .opblock:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

/* HTTP Method Colors */
#swagger-ui .opblock.opblock-get {
    border-left: 4px solid var(--color-get);
}

#swagger-ui .opblock.opblock-post {
    border-left: 4px solid var(--color-post);
}

#swagger-ui .opblock.opblock-put {
    border-left: 4px solid var(--color-put);
}

#swagger-ui .opblock.opblock-delete {
    border-left: 4px solid var(--color-delete);
}

#swagger-ui .opblock.opblock-patch {
    border-left: 4px solid var(--color-patch);
}

/* Operation Summary */
#swagger-ui .opblock .opblock-summary {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    cursor: pointer;
}

#swagger-ui .opblock .opblock-summary-method {
    border-radius: var(--radius-md);
    padding: 0.5rem 0;
    min-width: 90px;
    text-align: center;
    font-weight: 700;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

#swagger-ui .opblock.opblock-get .opblock-summary-method {
    background: var(--color-get);
}

#swagger-ui .opblock.opblock-post .opblock-summary-method {
    background: var(--color-post);
}

#swagger-ui .opblock.opblock-put .opblock-summary-method {
    background: var(--color-put);
}

#swagger-ui .opblock.opblock-delete .opblock-summary-method {
    background: var(--color-delete);
}

#swagger-ui .opblock.opblock-patch .opblock-summary-method {
    background: var(--color-patch);
}

#swagger-ui .opblock .opblock-summary-path {
    font-size: 1.0625rem;
    font-weight: 600;
    font-family: var(--font-family-mono);
    color: var(--color-gray-900);
    flex: 1;
}

#swagger-ui .opblock .opblock-summary-description {
    font-size: 0.9375rem;
    color: var(--color-gray-600);
    max-width: 600px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Operation Body */
#swagger-ui .opblock-body {
    padding: 1.5rem;
}

#swagger-ui .opblock-description-wrapper {
    padding: 1rem 1.5rem;
    background: var(--color-gray-50);
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
}

#swagger-ui .opblock-description {
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--color-gray-700);
}

/* Parameters */
#swagger-ui .parameters-container {
    padding: 1rem 0;
}

#swagger-ui .table-container {
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--color-gray-200);
}

#swagger-ui table thead tr {
    background: var(--color-gray-50);
}

#swagger-ui table thead tr th {
    font-weight: 600;
    color: var(--color-gray-900);
    padding: 0.875rem;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

#swagger-ui table tbody tr {
    border-top: 1px solid var(--color-gray-200);
}

#swagger-ui table tbody tr td {
    padding: 1rem 0.875rem;
    font-size: 0.9375rem;
}

/* Responses */
#swagger-ui .responses-wrapper {
    padding: 1rem 0;
}

#swagger-ui .responses-table {
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-gray-200);
    overflow: hidden;
}

#swagger-ui .response-col_status {
    font-weight: 700;
    font-family: var(--font-family-mono);
}

#swagger-ui .response-col_status.response-200,
#swagger-ui .response-col_status.response-201 {
    color: var(--color-success);
}

#swagger-ui .response-col_status.response-400,
#swagger-ui .response-col_status.response-404,
#swagger-ui .response-col_status.response-500 {
    color: var(--color-error);
}

/* Try it Out Button */
#swagger-ui .btn.try-out__btn {
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 0.625rem 1.25rem;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
}

#swagger-ui .btn.try-out__btn:hover {
    background: var(--color-primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Execute Button */
#swagger-ui .btn.execute {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 0.75rem 1.5rem;
    font-weight: 700;
    font-size: 0.9375rem;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-md);
}

#swagger-ui .btn.execute:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Authorize Button */
#swagger-ui .btn.authorize {
    background: var(--color-gray-900);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 0.5rem 1rem;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all var(--transition-base);
}

#swagger-ui .btn.authorize:hover {
    background: var(--color-gray-700);
}

#swagger-ui .btn.authorize svg {
    fill: white;
}

/* Models */
#swagger-ui .model-box {
    background: var(--color-gray-50);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin: 1rem 0;
}

#swagger-ui .model-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-gray-900);
    font-family: var(--font-family-mono);
}

/* Filter Box */
#swagger-ui .filter-container {
    margin: 2rem 0;
}

#swagger-ui .filter .operation-filter-input {
    border: 2px solid var(--color-gray-300);
    border-radius: var(--radius-lg);
    padding: 0.875rem 1.25rem;
    font-size: 1rem;
    width: 100%;
    transition: all var(--transition-fast);
    background: white;
    box-shadow: var(--shadow-sm);
}

#swagger-ui .filter .operation-filter-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* ============================================
   Footer
   ============================================ */

.api-footer {
    background: var(--color-gray-900);
    color: var(--color-gray-300);
    padding: 3rem 2rem 2rem;
    margin-top: 4rem;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 3rem;
}

.footer-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.footer-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: white;
    margin: 0 0 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.footer-link {
    color: var(--color-gray-400);
    text-decoration: none;
    font-size: 0.9375rem;
    transition: color var(--transition-fast);
}

.footer-link:hover {
    color: var(--color-primary-light);
}

.footer-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
}

.footer-copyright {
    font-size: 0.875rem;
    color: var(--color-gray-500);
    margin: 0;
}

/* ============================================
   Scroll to Top Button
   ============================================ */

.scroll-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 3rem;
    height: 3rem;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
    color: white;
    border: none;
    border-radius: 50%;
    box-shadow: var(--shadow-xl);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-to-top:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-2xl);
}

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

@media (max-width: 1024px) {
    .header-container {
        padding: 1rem 1.5rem;
    }
}

@media (max-width: 768px) {
    .header-nav {
        gap: 0.5rem;
    }

    .nav-link {
        display: none;
    }

    .nav-link-secondary {
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
    }

    .nav-link-download {
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
    }

    .brand-text {
        display: none;
    }

    .content-section {
        padding: 3rem 1.5rem;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .quick-start-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .footer-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .scroll-to-top {
        bottom: 1rem;
        right: 1rem;
    }
}

@media (max-width: 480px) {
    .header-container {
        padding: 0.875rem 1rem;
    }

    .code-tabs {
        flex-wrap: wrap;
    }

    .code-tab {
        font-size: 0.8125rem;
        padding: 0.5rem 1rem;
    }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    .api-header,
    .api-footer,
    .scroll-to-top,
    .nav-link-download,
    #swagger-ui .btn,
    #swagger-ui .try-out {
        display: none !important;
    }

    body {
        background: white;
    }

    #swagger-ui .opblock {
        box-shadow: none;
        page-break-inside: avoid;
    }
}

/* ============================================
   Utilities
   ============================================ */

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
