/* UCSB Brand Colors */
:root {
    --ucsb-navy: #003660;
    --ucsb-gold: #FEBC11;
    --ucsb-white: #FFFFFF;
    --ucsb-light-gray: #F5F5F5;
    --ucsb-dark-gray: #767676;
    --ucsb-clay: #DCD6CC;
    --ucsb-aqua: #047C91;
    --ucsb-coral: #EF5645;
    --ucsb-mist: #9CBEBE;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    line-height: 1.6;
    color: #333;
    min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
    width: 300px;
    background-color: var(--ucsb-navy);
    color: var(--ucsb-white);
    padding: 2rem 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 0 1.5rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.sidebar-logo {
    height: auto;
    width: 100%;
    max-width: 200px;
    max-height: 36px;
    margin-bottom: 1rem;
    display: block;
    object-fit: contain;
}

.sidebar-header h2 {
    color: var(--ucsb-gold);
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.sidebar-title-link {
    text-decoration: none;
}

.sidebar-title-link:hover h2 {
    opacity: 0.8;
}

.sidebar-header p {
    color: var(--ucsb-mist);
    font-size: 0.875rem;
}

.nav-menu {
    list-style: none;
    padding: 1rem 0;
}

.nav-menu li {
    margin: 0;
}

.nav-menu a {
    display: block;
    padding: 0.75rem 1.5rem;
    color: var(--ucsb-white);
    text-decoration: none;
    transition: background-color 0.2s;
}

.nav-menu a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--ucsb-white);
}

.nav-menu li.active a {
    background-color: var(--ucsb-gold);
    color: var(--ucsb-navy);
    font-weight: 600;
}

.nav-menu li.active a:hover {
    background-color: var(--ucsb-gold);
    color: var(--ucsb-navy);
}

.nav-section-header {
    color: var(--ucsb-gold);
    font-weight: 700;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 1.5rem 1.5rem 0.5rem;
    margin-top: 0.5rem;
}

/* Main Content */
.doc-content {
    margin-left: 300px;
    flex: 1;
    padding: 3rem;
    background-color: var(--ucsb-white);
}

.container {
    max-width: 900px;
}

h1 {
    color: var(--ucsb-navy);
    font-size: 2.5rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 3px solid var(--ucsb-gold);
}

h2 {
    color: var(--ucsb-navy);
    font-size: 1.75rem;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: none;
    position: relative;
}

h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 25%;
    height: 3px;
    background-color: var(--ucsb-gold);
    border-radius: 2px;
}

h3 {
    color: var(--ucsb-navy);
    font-size: 1.25rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.35rem;
    border-bottom: none;
    position: relative;
}

h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 25%;
    height: 2px;
    background-color: var(--ucsb-aqua);
    border-radius: 2px;
}

.doc-section {
    margin-bottom: 3rem;
}

/* Steps */
.steps {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin: 2rem 0;
}

.step {
    display: flex;
    gap: 1.5rem;
    align-items: start;
}

.step-number {
    width: 40px;
    height: 40px;
    background-color: var(--ucsb-gold);
    color: var(--ucsb-navy);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.125rem;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-content h3 {
    margin-top: 0;
}

/* Code Blocks */
pre {
    background-color: #282c34;
    padding: 1.5rem;
    border-radius: 6px;
    overflow-x: auto;
    border-left: 4px solid var(--ucsb-navy);
    margin: 1rem 0;
    position: relative;
}

.copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #abb2bf;
    font-size: 0.75rem;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

.copy-btn.copied {
    background: var(--ucsb-aqua);
    color: #fff;
    border-color: var(--ucsb-aqua);
}

pre code {
    background-color: transparent;
    padding: 0;
    color: #abb2bf;
    font-size: 0.875rem;
}

pre code.hljs {
    background: transparent;
    padding: 0;
}

code {
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    color: var(--ucsb-navy);
}

p code, li code, td code {
    background-color: var(--ucsb-light-gray);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.875rem;
}

/* Concept Grid */
.concept-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.concept-card {
    background-color: var(--ucsb-light-gray);
    padding: 1.5rem;
    border-radius: 6px;
    border-left: 4px solid var(--ucsb-aqua);
}

.concept-card h3 {
    margin-top: 0;
    color: var(--ucsb-navy);
    border-bottom: none;
    padding-bottom: 0;
}

.concept-card h3::after {
    display: none;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background-color: var(--ucsb-white);
}

thead {
    background-color: var(--ucsb-navy);
    color: var(--ucsb-white);
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--ucsb-clay);
}

tbody tr:hover {
    background-color: var(--ucsb-light-gray);
}

/* Alert Boxes */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 6px;
    margin: 1.5rem 0;
    border-left: 4px solid;
}

.alert-info {
    background-color: #e3f2fd;
    border-color: var(--ucsb-aqua);
    color: #01579b;
}

.alert-warning {
    background-color: #fff8e1;
    border-color: var(--ucsb-gold);
    color: #f57f17;
}

.alert-error {
    background-color: #ffebee;
    border-color: var(--ucsb-coral);
    color: #c62828;
}

/* Lists */
ul, ol {
    margin: 1rem 0;
    padding-left: 2rem;
}

li {
    margin: 0.5rem 0;
}

/* Links */
a {
    color: var(--ucsb-aqua);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
    color: var(--ucsb-navy);
}

/* ─── Mobile Header ─────────────────────────────────────────────────────────── */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background-color: var(--ucsb-navy);
    color: var(--ucsb-white);
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    z-index: 200;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.mobile-header-title {
    color: var(--ucsb-gold);
    font-size: 1.1rem;
    font-weight: 700;
    text-decoration: none;
}

.mobile-header-title:hover {
    opacity: 0.85;
    text-decoration: none;
}

/* Hamburger button */
.sidebar-toggle {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 26px;
    height: 20px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
}

.sidebar-toggle span {
    display: block;
    height: 2px;
    width: 100%;
    background-color: var(--ucsb-white);
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

/* Animate hamburger → X when sidebar is open */
body.sidebar-open .sidebar-toggle span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}
body.sidebar-open .sidebar-toggle span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
body.sidebar-open .sidebar-toggle span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* Overlay backdrop */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 149;
}

body.sidebar-open .sidebar-overlay {
    display: block;
}

/* ─── Responsive Design ─────────────────────────────────────────────────────── */
@media (max-width: 968px) {
    body {
        flex-direction: column;
        padding-top: 56px; /* room for fixed mobile header */
    }

    .mobile-header {
        display: flex;
    }

    /* Sidebar becomes an off-canvas drawer */
    .sidebar {
        position: fixed;
        top: 56px;
        left: 0;
        bottom: 0;
        width: 280px;
        height: auto;
        transform: translateX(-100%);
        transition: transform 0.28s ease;
        z-index: 150;
        overflow-y: auto;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .doc-content {
        margin-left: 0;
        padding: 2rem 1rem;
        min-width: 0; /* prevent flex blowout */
    }

    /* Tables: horizontal scroll on small screens */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    /* Allow code in table cells to wrap again after nowrap above */
    table td, table th {
        white-space: normal;
        min-width: 100px;
    }

    /* Code blocks */
    pre {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        font-size: 0.8rem;
        padding: 1rem;
    }

    /* Concept grid: single column */
    .concept-grid {
        grid-template-columns: 1fr;
    }

    /* Steps: tighter gap */
    .step {
        gap: 1rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.4rem;
    }

    h3 {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .doc-content {
        padding: 1.5rem 0.75rem;
    }

    pre {
        font-size: 0.75rem;
    }

    th, td {
        padding: 0.5rem;
    }

    h1 {
        font-size: 1.5rem;
    }
}

/* Parameter Tables */
.param-table {
    margin: 1.5rem 0;
}

.param-row {
    border: 1px solid var(--ucsb-clay);
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 6px;
    background-color: var(--ucsb-white);
}

.param-name {
    font-weight: 700;
    color: var(--ucsb-navy);
    font-family: 'Monaco', 'Courier New', monospace;
}

.param-type {
    display: inline-block;
    background-color: var(--ucsb-aqua);
    color: var(--ucsb-white);
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

.param-description {
    margin-top: 0.5rem;
    color: var(--ucsb-dark-gray);
}

/* Footer */
footer {
    background-color: var(--ucsb-navy);
    color: var(--ucsb-white);
    margin-left: 300px;
    padding: 3rem 2rem 2rem;
    display: block;
    position: relative;
    clear: both;
    width: auto;
}

.footer.container-fluid {
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
}

.footer .block-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 3rem;
}

.footer .paragraph {
    flex: 1;
    min-width: 280px;
}

.footer .ucsb-wordmark svg {
    width: 200px;
    height: auto;
    margin-bottom: 1.5rem;
    fill: var(--ucsb-white);
}

.footer .contact-info {
    color: var(--ucsb-white);
    line-height: 1.8;
}

.footer .site-name {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.footer .contact-line {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.85);
}

.footer .second-column h2.label {
    color: var(--ucsb-gold);
    font-size: 1.1rem;
    margin-bottom: 1rem;
    border-bottom: none;
    padding-bottom: 0;
}

.footer .second-column h2.label::after {
    display: none;
}

.footer .second-column p {
    margin: 0.5rem 0;
}

.footer .second-column a {
    color: var(--ucsb-white);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.footer .second-column a:hover {
    color: var(--ucsb-gold);
    text-decoration: underline;
}

.footer .offsite {
    width: 16px;
    height: 16px;
}

.footer .offsite path {
    fill: var(--ucsb-aqua);
}

.footer-bottom {
    background-color: var(--ucsb-navy);
    color: rgba(255, 255, 255, 0.8);
    padding: 1.5rem 2rem;
    margin-left: 300px;
    margin-top: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: block;
    position: relative;
    width: auto;
}

.footer-bottom .copyright {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    max-width: 900px;
    margin: 0 auto;
    font-size: 0.875rem;
    justify-content: center;
}

.footer-bottom .separator {
    color: rgba(255, 255, 255, 0.4);
}

.footer-bottom a.terms {
    color: var(--ucsb-white);
    text-decoration: none;
}

.footer-bottom a.terms:hover {
    color: var(--ucsb-gold);
    text-decoration: underline;
}

@media (max-width: 968px) {
    footer {
        margin-left: 0;
        width: 100%;
    }

    .footer-bottom {
        margin-left: 0;
        width: 100%;
    }

    .footer .block-inner {
        flex-direction: column;
    }
}

@media (max-width: 600px) {
    .footer-bottom .copyright {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .footer-bottom .separator {
        display: none;
    }
}

/* API Tester Component */
.api-tester {
    background-color: var(--ucsb-light-gray);
    border: 1px solid var(--ucsb-clay);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 2rem 0;
}

.api-tester-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--ucsb-gold);
}

.api-tester-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--ucsb-navy);
    border-bottom: none;
    padding-bottom: 0;
}

.api-tester-header h3::after {
    display: none;
}

.api-method {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
}

.api-method.get {
    background-color: #61affe;
    color: white;
}

.api-method.post {
    background-color: #49cc90;
    color: white;
}

.api-method.put {
    background-color: #fca130;
    color: white;
}

.api-method.delete {
    background-color: #f93e3e;
    color: white;
}

.api-tester-form {
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--ucsb-navy);
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--ucsb-clay);
    border-radius: 4px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    background-color: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--ucsb-aqua);
    box-shadow: 0 0 0 3px rgba(4, 124, 145, 0.1);
}

.form-text {
    display: block;
    font-size: 0.75rem;
    color: var(--ucsb-dark-gray);
    margin-top: 0.25rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--ucsb-navy);
    color: white;
}

.btn-primary:hover {
    background-color: #002849;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 54, 96, 0.3);
}

.btn-secondary {
    background-color: var(--ucsb-dark-gray);
    color: white;
    margin-left: 0.5rem;
}

.btn-secondary:hover {
    background-color: #5a5a5a;
}

.api-tester-request,
.api-tester-response,
.api-tester-error {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--ucsb-clay);
}

.api-tester-request h4,
.api-tester-response h4,
.api-tester-error h4 {
    font-size: 1rem;
    color: var(--ucsb-navy);
    margin-bottom: 0.75rem;
}

.response-status {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-weight: 600;
    margin-bottom: 1rem;
}

.response-status.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.response-status.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.api-tester-error .error-message {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 1rem;
    border-radius: 4px;
}

.api-tester-error .error-message pre {
    background-color: transparent;
    border: none;
    padding: 0.5rem 0 0 0;
    margin: 0.5rem 0 0 0;
}

.api-tester-error .error-message code {
    color: #721c24;
    font-size: 0.8rem;
}

@media (max-width: 768px) {
    .api-tester {
        padding: 1rem;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .btn-secondary {
        margin-left: 0;
    }
}
