/* Global Styles */
:root {
    --primary-color: #4e73df;
    --secondary-color: #858796;
    --success-color: #1cc88a;
    --info-color: #36b9cc;
    --warning-color: #f6c23e;
    --danger-color: #e74a3b;
    --light-color: #f8f9fc;
    --dark-color: #5a5c69;
    --font-family-sans-serif: 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', 'WenQuanYi Micro Hei', sans-serif;
    --font-family-monospace: 'Courier New', Courier, monospace;
    --border-radius: 0.375rem;
    --box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --transition: all 0.3s ease;
}

body {
    font-family: var(--font-family-sans-serif);
    line-height: 1.7;
    color: #333;
    background-color: #f8f9fc;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    margin-bottom: 0.75rem;
    line-height: 1.4;
    color: #2c3e50;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: #0b5ed7;
    text-decoration: underline;
}

/* Navbar */
.navbar {
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    padding: 0.5rem 0;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.4rem;
    color: #fff !important;
}

.navbar .nav-link {
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.2s;
}

/* Cards */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 2rem 0 rgba(58, 59, 69, 0.2);
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1rem 1.25rem;
    font-weight: 600;
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    background-color: #fff;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1rem 1.25rem;
}

/* Command Cards */
.command-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.command-card .card-body {
    flex: 1;
}

.command-card .syntax-preview {
    background-color: #f8f9fa;
    border-radius: var(--border-radius);
    padding: 0.75rem;
    margin-top: 1rem;
    font-family: var(--font-family-monospace);
    font-size: 0.85rem;
    overflow-x: auto;
}

.command-card:hover {
    border-color: var(--primary-color);
}

.command-card .card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.command-card .card-text {
    color: #6c757d;
    font-size: 0.95rem;
    margin-bottom: 1rem;
    min-height: 3em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* List View */
.list-view .command-row {
    cursor: pointer;
    transition: var(--transition);
}

.list-view .command-row:hover {
    background-color: rgba(13, 110, 253, 0.05);
}

.list-view .table {
    margin-bottom: 0;
}

.list-view .table th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    color: #6e707e;
    background-color: #f8f9fc;
    border-bottom: 1px solid #e3e6f0;
}

.list-view .table td {
    vertical-align: middle;
    padding: 1rem;
    border-top: 1px solid #e3e6f0;
}

/* Code Highlighting */
pre {
    background-color: #f8f9fc;
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 1rem;
    overflow-x: auto;
}

code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    color: #e83e8c;
    word-break: break-word;
}

pre code {
    color: inherit;
    word-break: normal;
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    border-radius: 0.25rem;
    text-transform: none;
    letter-spacing: normal;
}

/* Buttons */
.btn {
    font-weight: 500;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #2e59d9;
    border-color: #2653d4;
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Forms */
.form-control {
    border: 1px solid #d1d3e2;
    border-radius: var(--border-radius);
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    border-color: #bac8f3;
    box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25);
}

/* Pagination */
.pagination {
    margin: 1.5rem 0 0;
}

.page-link {
    color: var(--primary-color);
    border: 1px solid #e3e6f0;
    padding: 0.5rem 0.75rem;
    margin: 0 0.2rem;
    border-radius: var(--border-radius) !important;
    transition: all 0.2s;
}

.page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.page-link:hover {
    color: #224abe;
    background-color: #eaecf4;
    border-color: #e3e6f0;
}

/* Modal */
.modal-content {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.modal-header {
    border-bottom: 1px solid #e3e6f0;
    padding: 1.25rem 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid #e3e6f0;
    padding: 1rem 1.5rem;
}

/* Loading Spinner */
#loading-spinner {
    padding: 2rem 0;
    color: var(--primary-color);
}

.loading-spinner {
    width: 2rem;
    height: 2rem;
    border: 0.25rem solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top: 0.25rem solid var(--primary-color);
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

/* Responsive Adjustments */
@media (max-width: 767.98px) {
    .navbar-brand {
        font-size: 1.25rem;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .command-card .card-body {
        padding: 1rem;
    }
    
    #search-command {
        margin-top: 0.5rem;
    }
    
    .modal-dialog {
        margin: 0.5rem;
    }
}

@media (max-width: 768px) {
    .card-body {
        padding: 1rem;
    }
    
    .command-card .card-text {
        min-height: auto;
        -webkit-line-clamp: 3;
    }
    
    .list-view .table td, 
    .list-view .table th {
        padding: 0.75rem 0.5rem;
    }
}

/* Animation for cards */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.command-card {
    animation: fadeIn 0.3s ease-out forwards;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Syntax highlighting overrides */
.hljs {
    background: transparent !important;
    padding: 0 !important;
}

/* Footer */
footer {
    background-color: #fff;
    padding: 2rem 0;
    margin-top: 3rem;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

/* Utility Classes */
.rounded-top {
    border-top-left-radius: var(--border-radius) !important;
    border-top-right-radius: var(--border-radius) !important;
}

.rounded-bottom {
    border-bottom-left-radius: var(--border-radius) !important;
    border-bottom-right-radius: var(--border-radius) !important;
}

.cursor-pointer {
    cursor: pointer;
}

/* Custom styles for the command details modal */
#commandModal .modal-body {
    padding: 1.5rem;
}

#commandModal pre {
    margin-bottom: 0;
}

#commandModal .modal-title {
    font-weight: 600;
}

/* Responsive tables */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Custom checkbox styling */
.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.form-check-input:focus {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .card {
        border: 1px solid #e3e6f0;
        box-shadow: none;
    }
}
