/* Custom styles for Wallpaper Engine Manager */

:root {
    --primary-color: #007bff;
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
    --dark-color: #343a40;
    --light-color: #f8f9fa;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --shadow-primary: 0 8px 32px rgba(31, 38, 135, 0.37);
    --shadow-hover: 0 8px 32px rgba(31, 38, 135, 0.5);
}

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-attachment: fixed;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
}

/* Glass morphism effect */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
}

/* Navbar enhancements */
.navbar {
    background: rgba(255, 255, 255, 0.15) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.navbar-brand {
    font-weight: 700;
    color: white !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 500;
}

/* Path display improvements */
#wallpaperDetailPath {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: top;
}

#wallpaperDetailPath:hover {
    overflow: visible;
    white-space: normal;
    word-break: break-all;
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 4px;
    border-radius: 4px;
}

.navbar-nav .nav-link:hover {
    color: white !important;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    color: white;
}

.loading-overlay.hidden {
    display: none;
}

/* Wallpaper Grid - 每行5个卡片 */
.wallpaper-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    min-height: 200px;
}

.wallpaper-card {
    border: 1px solid #dee2e6;
    border-radius: 0.75rem;
    overflow: hidden;
    background: white;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.wallpaper-card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transform: translateY(-4px);
    border-color: var(--primary-color);
}

.wallpaper-card.selected {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.wallpaper-preview {
    width: 100%;
    height: 160px;
    object-fit: cover;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.9rem;
    position: relative;
}

.wallpaper-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wallpaper-preview.loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

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

.wallpaper-info {
    padding: 0.75rem;
    background: white;
}

.wallpaper-title {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
    min-height: 2.2rem;
}

.wallpaper-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}

.wallpaper-id {
    font-size: 0.75rem;
    color: #6c757d;
    font-family: 'Courier New', monospace;
    font-weight: 500;
}

.wallpaper-size {
    font-size: 0.75rem;
    color: #6c757d;
    font-weight: 500;
}

.wallpaper-status {
    margin-top: 0.4rem;
}

.wallpaper-checkbox {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 10;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 4px;
    padding: 2px;
}

/* Status badges */
.status-subscribed {
    background-color: var(--success-color);
    color: white;
}

.status-unsubscribed {
    background-color: var(--warning-color);
    color: white;
}

/* Cards with glass effect */
.card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    box-shadow: var(--shadow-primary);
    transition: all 0.3s ease;
}

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

.card-header {
    background: rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px 15px 0 0 !important;
}

/* Enhanced statistics cards */
.card.bg-primary,
.card.bg-success,
.card.bg-warning,
.card.bg-info {
    border: none;
    background: var(--primary-gradient) !important;
    color: white;
    position: relative;
    overflow: hidden;
}

.card.bg-success {
    background: linear-gradient(135deg, #56ab2f 0%, #a8e6cf 100%) !important;
}

.card.bg-warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%) !important;
}

.card.bg-info {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%) !important;
}

.card.bg-primary::before,
.card.bg-success::before,
.card.bg-warning::before,
.card.bg-info::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card.bg-primary:hover::before,
.card.bg-success:hover::before,
.card.bg-warning:hover::before,
.card.bg-info:hover::before {
    opacity: 1;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .wallpaper-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 992px) {
    .wallpaper-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.8rem;
    }
    
    .wallpaper-preview {
        height: 140px;
    }
}

@media (max-width: 768px) {
    .wallpaper-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .wallpaper-preview {
        height: 120px;
    }
    
    .wallpaper-info {
        padding: 0.6rem;
    }
    
    .wallpaper-title {
        font-size: 0.8rem;
    }
}

@media (max-width: 576px) {
    .wallpaper-grid {
        grid-template-columns: 1fr;
        gap: 0.6rem;
    }
    
    .wallpaper-preview {
        height: 180px;
    }
    
    .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Toast customization */
.toast {
    max-width: 350px;
}

/* Modal adjustments with glass effect */
.modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    box-shadow: var(--shadow-primary);
}

.modal-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px 20px 0 0;
}

.modal-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0 0 20px 20px;
}

.modal-lg {
    max-width: 900px;
}

#wallpaperPreviewLarge {
    max-height: 400px;
    width: 100%;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Modal table styling */
.modal-body .table {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    overflow: hidden;
}

.modal-body .table td {
    border-color: rgba(255, 255, 255, 0.3);
    vertical-align: middle;
}

.modal-body .table td:first-child {
    width: 80px;
    font-weight: 600;
    color: #495057;
}

#wallpaperDetailPath {
    word-break: break-all;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
}

/* Enhanced buttons */
.btn {
    border-radius: 10px;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: var(--primary-gradient);
    border: none;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

/* Form controls */
.form-control,
.form-select {
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    background: white;
}

.input-group-text {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px 0 0 10px;
}

/* Navigation tabs */
.nav-tabs {
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.nav-tabs .nav-link {
    border: none;
    border-radius: 10px 10px 0 0;
    background: rgba(255, 255, 255, 0.1);
    color: #495057;
    margin-right: 5px;
    transition: all 0.3s ease;
}

.nav-tabs .nav-link:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: transparent;
}

.nav-tabs .nav-link.active {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.3);
    color: #495057;
    font-weight: 600;
}

/* Button loading state */
.btn.loading {
    position: relative;
    color: transparent;
}

.btn.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Checkbox styling */
.form-check-input {
    border-radius: 6px;
    transition: all 0.3s ease;
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Tab content */
.tab-content {
    min-height: 400px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0 0 15px 15px;
    padding: 1.5rem;
}

/* Toast customization */
.toast {
    max-width: 350px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    box-shadow: var(--shadow-primary);
}

/* Alert styling */
.alert {
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Badge enhancements */
.badge {
    border-radius: 20px;
    font-weight: 500;
    padding: 0.4em 0.8em;
}

/* Utility classes */
.cursor-pointer {
    cursor: pointer;
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Container improvements */
.container-fluid {
    padding-top: 2rem;
    padding-bottom: 2rem;
}

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

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}
