/**
 * 极AI Design System - Apple-Inspired
 * Based on ui-design.md specifications
 * "理性美学，隐形秩序" (Rational Aesthetics & Invisible Order)
 */

:root {
    /* Apple Design System Colors */
    --bg-body: #F5F5F7;
    --bg-card: #FFFFFF;
    --bg-nav: rgba(255, 255, 255, 0.85);

    --text-primary: #1D1D1F;
    --text-secondary: #86868B;
    --text-tertiary: #98989D;
    --text-nav: #424245;

    --accent-blue: #0071E3;
    --accent-blue-hover: #0077ED;

    --border-light: rgba(0, 0, 0, 0.05);
    --border-subtle: #E5E5EA;
    --border-card: #F0F0F2;

    /* Radius */
    --radius-card: 20px;
    --radius-button: 98px;
    --radius-small: 8px;
    --radius-tiny: 6px;

    /* Shadows */
    --shadow-card: 0 4px 12px rgba(0, 0, 0, 0.03);
    --shadow-hover: 0 12px 24px rgba(0, 0, 0, 0.06);
    --shadow-strong: 0 1px 3px rgba(0, 0, 0, 0.12);

    /* Font Stack */
    --font-stack: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", sans-serif;
    --font-mono: "SF Mono", "Menlo", "Monaco", "Courier New", monospace;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 20px;
    --space-2xl: 24px;
    --space-3xl: 32px;
}

/* Base Styles */
body {
    font-family: var(--font-stack);
    background-color: var(--bg-body);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography */
.text-primary {
    color: var(--text-primary);
}

.text-secondary {
    color: var(--text-secondary);
}

.text-mono {
    font-family: var(--font-mono);
}

/* Cards */
.design-card {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.design-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.design-card-sm {
    background: var(--bg-card);
    border-radius: var(--radius-small);
    box-shadow: var(--shadow-card);
}

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 24px;
    height: 40px;
    background-color: var(--accent-blue);
    color: white;
    border: none;
    border-radius: var(--radius-button);
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background-color: var(--accent-blue-hover);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 24px;
    height: 40px;
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-button);
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background-color: var(--bg-body);
    border-color: var(--text-secondary);
}

/* Segmented Controls (iOS-style) */
.segment-control-container {
    background: #F2F2F7;
    padding: 2px;
    border-radius: var(--radius-small);
    display: inline-flex;
    gap: 0;
}

.segment-item {
    padding: 4px 12px;
    border-radius: var(--radius-tiny);
    font-size: 12px;
    cursor: pointer;
    color: var(--text-secondary);
    background: transparent;
    transition: all 0.2s;
    font-weight: 400;
    border: none;
}

.segment-item:hover:not(.active) {
    color: var(--text-nav);
}

.segment-item.active {
    background: white;
    color: var(--text-primary);
    box-shadow: var(--shadow-strong);
    font-weight: 600;
}

/* Tables */
.design-table {
    width: 100%;
    border-collapse: collapse;
}

.design-table thead th {
    padding: 14px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-card);
}

.design-table tbody td {
    padding: 14px 16px;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid #F5F5F7;
}

.design-table tbody tr:last-child td {
    border-bottom: none;
}

.design-table tbody tr:hover {
    background-color: #FAFAFC;
}

/* Remove vertical borders */
.design-table td,
.design-table th {
    border-left: none;
    border-right: none;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-primary {
    background: #E1F0FF;
    color: var(--accent-blue);
}

.badge-success {
    background: #E4F9F3;
    color: #00A492;
}

.badge-warning {
    background: #FFF4D6;
    color: #9A7D0A;
}

.badge-error {
    background: #FFECE8;
    color: #C84936;
}

.badge-neutral {
    background: #F2F2F7;
    color: #636366;
}

/* Input Fields */
.input-field {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-small);
    font-size: 14px;
    font-family: var(--font-stack);
    color: var(--text-primary);
    background: white;
    transition: all 0.2s;
}

.input-field:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1);
}

.input-field::placeholder {
    color: var(--text-secondary);
}

/* Navigation */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: var(--bg-nav);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--border-light);
    height: 52px;
}

.nav-item {
    position: relative;
    color: var(--text-nav);
    font-size: 13px;
    font-weight: 400;
    text-decoration: none;
    transition: all 0.2s ease;
    padding: 4px 12px;
}

.nav-item:hover,
.nav-item.active {
    color: var(--text-primary);
    font-weight: 500;
}

.nav-item.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-blue);
    border-radius: 1px;
}

/* Footer */
.design-footer {
    margin-top: var(--space-3xl);
    padding: 24px 0 32px;
    text-align: center;
    border-top: 1px solid var(--border-light);
}

.design-footer-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}

.design-footer-logo {
    background: linear-gradient(135deg, #00C6FB 0%, #005BEA 100%);
    width: 20px;
    height: 20px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 113, 227, 0.2);
}

.design-footer-copyright {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Modal */
.design-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    z-index: 9998;
}

.design-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: var(--radius-card);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
    z-index: 9999;
}

/* Loading States */
.skeleton {
    background: linear-gradient(90deg, #F5F5F7 25%, #E5E5EA 50%, #F5F5F7 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-small);
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Utilities */
.container-center {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

.glass-effect {
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
}

/* Responsive */
@media (max-width: 768px) {
    .design-card {
        border-radius: 12px;
    }

    .container-center {
        padding: 0 16px;
    }
}
