/* ============================================================
   简切板 — Custom Styles
   ============================================================ */

/* --- Design Tokens --- */
:root {
    --primary: #0d9488;
    --primary-light: #14b8a6;
    --primary-lighter: #99f6e4;
    --accent: #06b6d4;
    --surface: #ffffff;
    --surface-hover: #f8fafc;
    --bg: #f1f5f9;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: 0.2s ease;
}

/* --- Base --- */
body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", "Noto Sans", sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Navbar — Glassmorphism --- */
.site-navbar {
    background: linear-gradient(135deg, rgba(13, 148, 136, 0.85) 0%, rgba(6, 182, 212, 0.85) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 1px 8px rgba(13, 148, 136, 0.2);
    position: sticky;
    top: 0;
    z-index: 1030;
    transition: box-shadow var(--transition);
}

.site-navbar.scrolled {
    box-shadow: 0 4px 20px rgba(13, 148, 136, 0.25);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
    transition: opacity var(--transition);
}

.navbar-brand:hover {
    opacity: 0.9;
}

/* --- Cards --- */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), border-color var(--transition);
    background: var(--surface);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border-light);
    padding: 0.75rem 1rem;
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    background: var(--surface);
    border-top: 1px solid var(--border-light);
    padding: 0.75rem 1rem;
}

/* --- Entry Cards — Gradient Left Border --- */
.entry-card {
    border-left: 3px solid transparent;
    border-image: linear-gradient(180deg, var(--primary) 0%, var(--accent) 100%) 1;
    border-left-style: solid;
    border-radius: 0;
    transition: all var(--transition);
}

.entry-card:hover {
    border-left-width: 4px;
    box-shadow: var(--shadow-md);
    transform: translateX(2px);
}

/* Override border-image with pseudo-element for rounded corners compatibility */
.entry-card {
    border-left: none;
    position: relative;
}

.entry-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, var(--primary) 0%, var(--accent) 100%);
    border-radius: 3px 0 0 3px;
    transition: width var(--transition);
}

.entry-card:hover::before {
    width: 4px;
}

/* --- Entry Content --- */
.entry-content {
    background: var(--surface-hover);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 0.875rem 1rem;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 400px;
    overflow-y: auto;
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text);
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, 'Liberation Mono', Menlo, monospace;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.entry-content::-webkit-scrollbar {
    width: 6px;
}

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

.entry-content::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

/* --- Share URL --- */
code#share-url {
    font-size: 0.85rem;
    color: var(--primary);
    background: rgba(13, 148, 136, 0.06);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(13, 148, 136, 0.12);
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, 'Liberation Mono', Menlo, monospace;
}

/* --- Buttons --- */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.875rem;
    transition: all var(--transition);
    letter-spacing: -0.01em;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-light);
    border-color: var(--primary-light);
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3);
}

.btn-outline-info {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-outline-info:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn-outline-secondary {
    color: var(--text-muted);
    border-color: var(--border);
}

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

.btn-outline-danger:hover {
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}

/* --- Form Controls --- */
.form-control,
.form-select {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition), box-shadow var(--transition);
    color: var(--text);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}

.form-control::placeholder {
    color: #94a3b8;
}

.input-group-text {
    background: var(--surface-hover);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* --- Badges --- */
.badge {
    font-weight: 500;
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
    border-radius: 6px;
    letter-spacing: 0.01em;
}

.badge.bg-primary {
    background: rgba(13, 148, 136, 0.12) !important;
    color: var(--primary) !important;
}

.badge.bg-success {
    background: rgba(34, 197, 94, 0.12) !important;
    color: #16a34a !important;
}

/* --- Timeline --- */
.timeline {
    position: relative;
    padding-left: 1.5rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, var(--primary-lighter) 0%, var(--border) 100%);
    border-radius: 1px;
}

.timeline .entry-card + .entry-card {
    margin-top: 0.75rem;
}

.timeline .entry-card + .entry-card::after {
    content: '';
    position: absolute;
    left: -1.05rem;
    top: 50%;
    width: 8px;
    height: 8px;
    background: var(--primary);
    border: 2px solid var(--surface);
    border-radius: 50%;
    transform: translateY(-50%);
    box-shadow: 0 0 0 2px var(--primary-lighter);
}

/* --- Modals --- */
.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.modal-header {
    border-bottom: 1px solid var(--border-light);
    padding: 1.25rem 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--border-light);
    padding: 1rem 1.5rem;
}

.modal-title {
    font-weight: 600;
    font-size: 1.1rem;
}

/* --- Tabs (Input Area) --- */
.nav-tabs {
    border-bottom: 1px solid var(--border-light);
}

.nav-tabs .nav-link {
    color: var(--text-muted);
    border: none;
    border-bottom: 2px solid transparent;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all var(--transition);
    padding: 0.75rem 1rem;
}

.nav-tabs .nav-link:hover {
    color: var(--primary);
    border-bottom-color: var(--primary-lighter);
}

.nav-tabs .nav-link.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: transparent;
}

/* --- Alerts --- */
.alert-danger {
    border-radius: var(--radius-sm);
    border: 1px solid rgba(220, 38, 38, 0.15);
    background: rgba(220, 38, 38, 0.06);
    color: #991b1b;
    font-size: 0.875rem;
}

/* --- Landing Page Enhancements --- */
.landing-hero {
    position: relative;
}

.landing-hero h1 {
    font-weight: 700;
    font-size: 2.5rem;
    letter-spacing: -0.03em;
    color: var(--text);
}

.landing-hero h1::after {
    content: '';
    display: block;
    width: 48px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 2px;
    margin: 0.75rem auto 0;
}

.landing-hero p {
    color: var(--text-muted);
    font-size: 1.05rem;
    margin-top: 0.75rem;
}

.landing-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.landing-card .card-body {
    padding: 2rem;
}

/* --- Empty State --- */
.empty-state {
    padding: 3rem 1rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.empty-state::before {
    content: '';
    display: block;
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    background: var(--border-light);
    border-radius: 50%;
    /* Subtle icon placeholder */
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #cbd5e1;
}

/* --- Smooth page transitions --- */
main {
    animation: fadeIn 0.3s ease;
}

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

/* ============================================================
   Mobile Optimizations
   ============================================================ */
@media (max-width: 768px) {
    .btn {
        min-height: 44px;
        min-width: 44px;
    }

    .card-body {
        padding: 0.875rem;
    }

    .d-flex.align-items-center {
        flex-wrap: wrap;
    }

    .entry-content {
        font-size: 0.8125rem;
        padding: 0.625rem 0.875rem;
    }

    .form-control[type="file"] {
        padding: 0.75rem;
    }

    .mobile-textarea {
        min-height: 120px;
        font-size: 16px;
    }

    .mobile-file-input {
        padding: 1rem;
        text-align: center;
        border-style: dashed;
        border-width: 2px;
        background-color: var(--surface-hover);
    }

    .w-sm-auto {
        width: 100% !important;
    }

    .modal-footer .btn {
        flex: 1;
        margin: 0.25rem;
    }

    .card-footer {
        flex-direction: column;
        align-items: stretch !important;
        gap: 0.5rem !important;
    }

    .card-footer .d-flex {
        width: 100%;
        justify-content: space-between;
    }

    .nav-tabs .nav-link {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }

    .landing-hero h1 {
        font-size: 1.75rem;
    }

    .landing-card .card-body {
        padding: 1.25rem;
    }

    .landing-hero h1::after {
        width: 36px;
    }

    .timeline {
        padding-left: 1rem;
    }

    .timeline::before {
        left: 0.25rem;
    }
}

/* ============================================================
   Share URL Card Styles
   ============================================================ */
.share-url-card {
    background: linear-gradient(135deg, rgba(13, 148, 136, 0.03), rgba(6, 182, 212, 0.03));
}

.share-url-label {
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    font-size: 0.7rem;
}

.share-url-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.share-url-text {
    flex: 1;
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
}

.share-url-copy {
    flex-shrink: 0;
    padding-left: 0.85rem;
    padding-right: 0.85rem;
}

.share-url-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
}

/* ============================================================
   Settings Footer Styles
   ============================================================ */
.settings-footer {
    padding: 0.75rem 1rem;
}

.settings-panel-content {
    border-top: 1px solid var(--border-light);
    padding-top: 0.75rem;
}

.settings-group {
    margin-bottom: 0.5rem;
}

.settings-group:last-child {
    margin-bottom: 0;
}

.expiry-badge {
    font-size: 0.7rem;
}

/* ============================================================
   Entry Header Styles
   ============================================================ */
.entry-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.entry-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.entry-delete-btn {
    flex-shrink: 0;
    min-height: 36px;
    min-width: 36px;
    padding: 0;
    line-height: 1;
}

/* ============================================================
   Small Phone Breakpoint (375px and below)
   ============================================================ */
@media (max-width: 375px) {
    .container {
        padding-left: 12px;
        padding-right: 12px;
    }

    .card {
        border-radius: 10px;
    }

    .card-body {
        padding: 0.75rem;
    }
}

/* ============================================================
   Standard Phone Breakpoint (376px - 576px)
   ============================================================ */
@media (max-width: 576px) {
    .entry-content {
        font-size: 0.8125rem;
        padding: 0.625rem;
        max-height: 300px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    code#share-url,
    .share-url-text {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ============================================================
   Touch Target Optimization
   ============================================================ */
@media (max-width: 768px) {
    .btn {
        min-height: 44px;
    }

    .btn-sm {
        min-height: 36px;
        padding: 0.375rem 0.75rem;
    }

    .form-control,
    .form-select {
        min-height: 44px;
        font-size: 16px;
    }

    .nav-tabs .nav-link {
        min-height: 48px;
    }

    .modal-footer {
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
        min-height: 48px;
    }
}
