/* ==========================================
   iSentrol® 网址导航 - nav.css
   ========================================== */

:root {
    --primary-color: #0277bd;
    --primary-light: #0288d1;
    --primary-dark: #01579b;
    --bg-light: #f5faff;
    --border-color: #e1f5fe;
    --text-color: #37474f;
    --radius-sm: 4px;
    --radius-md: 6px;
    --transition-base: 0.3s ease;
    --transition-fast: 0.2s ease;
    --danger: #e53935;
    --shadow: 0 1px 4px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    min-height: 100vh;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-color);
    padding: 20px;
}

a { color: var(--primary-light); text-decoration: none; transition: color var(--transition-base); }
a:hover { color: var(--primary-dark); }

/* ==========================================
   Header
   ========================================== */
.header {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-light));
    color: white;
    padding: 15px 25px;
    border-radius: var(--radius-md);
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-lg);
}

.header-title {
    font-size: 26px;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
}

.header-title:hover { opacity: 0.85; }

.header-title-input {
    font-size: 26px;
    font-weight: 700;
    background: rgba(255,255,255,0.2);
    border: 2px dashed rgba(255,255,255,0.5);
    border-radius: 6px;
    padding: 4px 12px;
    color: white;
    outline: none;
    width: 200px;
    text-align: center;
}

/* ==========================================
   Search Box
   ========================================== */
.search-box {
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
}

.search-box input {
    padding: 8px 15px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.15);
    color: white;
    font-size: 14px;
    width: 200px;
}

.search-box input::placeholder { color: rgba(255,255,255,0.6); }

.search-box input:focus {
    outline: none;
    border-color: rgba(255,255,255,0.6);
    background: rgba(255,255,255,0.25);
}

/* ==========================================
   Admin Bar
   ========================================== */
.admin-bar {
    display: none;
    padding: 12px 20px;
    background: #fff3e0;
    border-bottom: 1px solid #ffe0b2;
    text-align: right;
    margin-bottom: 20px;
    border-radius: var(--radius-sm);
}

.admin-bar.visible { display: block; }

/* ==========================================
   Buttons
   ========================================== */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    transition: all var(--transition-fast);
    font-family: inherit;
    margin-left: 8px;
}

.btn-primary { background: var(--primary-color); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #eceff1; color: var(--text-color); }
.btn-secondary:hover { background: #cfd8dc; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #c62828; }

/* ==========================================
   Main Content
   ========================================== */
.main {
    max-width: 1400px;
    margin: 0 auto;
}

.category-section {
    background: white;
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.category-name {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary-dark);
}

.category-actions {
    display: flex;
    gap: 8px;
}

.category-actions .btn-sm {
    padding: 4px 12px;
    font-size: 13px;
}

/* ==========================================
   Links Grid
   ========================================== */
.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.link-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    background: var(--bg-light);
    transition: all var(--transition-base);
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    position: relative;
    min-height: 80px;
}

.link-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    border-color: var(--border-highlight);
}

.link-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

.link-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary-dark);
    position: relative;
    z-index: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.4;
}

.link-desc, .link-url {
    position: relative;
    z-index: 2;
}

.link-actions {
    position: relative;
    z-index: 3;
}

.link-desc {
    font-size: 12px;
    color: #666;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.link-url {
    font-size: 11px;
    color: #999;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.link-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

/* ==========================================
   Modal
   ========================================== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
    background: white;
    border-radius: var(--radius-md);
    width: 90%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-dark);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #999;
}

.modal-body { padding: 20px; }

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    text-align: right;
}

.modal-footer .btn { margin-left: 8px; }

/* ==========================================
   Form
   ========================================== */
.form-group { margin-bottom: 15px; }

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 14px;
    color: var(--primary-dark);
}

.form-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
}

.url-input-wrapper {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.url-prefix {
    padding: 8px 12px;
    background: #f5f5f5;
    color: #666;
    font-size: 14px;
    font-family: inherit;
    border-right: 1px solid var(--border-color);
}

.url-input {
    border: none;
    border-radius: 0;
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    font-family: inherit;
}

.url-input:focus { outline: none; }

.form-input:focus {
    outline: none;
    border-color: var(--primary-light);
}

/* ==========================================
   Password Modal
   ========================================== */
.password-modal .modal { max-width: 350px; }

/* ==========================================
   Empty State
   ========================================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state div:first-child {
    font-size: 64px;
    margin-bottom: 15px;
}

/* ==========================================
   Footer
   ========================================== */
.footer {
    text-align: center;
    padding: 20px;
    font-size: 13px;
    color: #999;
    margin-top: 30px;
}

/* ==========================================
   Toast
   ========================================== */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-dark);
    color: white;
    padding: 12px 25px;
    border-radius: 25px;
    font-size: 14px;
    z-index: 300;
    opacity: 0;
    transition: opacity var(--transition-base);
    pointer-events: none;
}

.toast.show { opacity: 1; }

/* ==========================================
   Responsive
   ========================================== */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
    .links-grid {
        grid-template-columns: 1fr;
    }
}
