/**
 * KitapNest UI Improvements
 * Modern, responsive, user-friendly styling
 * 
 * Son güncelleme: Aralık 2025
 */

/* ==================== VARIABLES ==================== */
:root {
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --light-bg: #f8fafc;
    --dark-text: #1e293b;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

/* ==================== GLOBAL IMPROVEMENTS ==================== */

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: var(--dark-text);
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* ==================== BUTTONS ==================== */

.btn {
    border-radius: var(--border-radius);
    transition: var(--transition);
    font-weight: 500;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
}

.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: '';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: translateY(-50%) rotate(360deg); }
}

/* ==================== CARDS ==================== */

.card {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    overflow: hidden;
}

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

.card-img-top {
    height: 250px;
    object-fit: cover;
}

/* ==================== LOADING SKELETON ==================== */

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

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

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: 12px;
}

.skeleton-image {
    height: 250px;
    margin-bottom: 12px;
}

/* ==================== FORMS ==================== */

.form-control, .form-select {
    border-radius: var(--border-radius);
    border: 2px solid #e2e8f0;
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-label {
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--dark-text);
}

.invalid-feedback {
    display: block;
    margin-top: 4px;
    font-size: 0.875rem;
}

/* ==================== ALERTS ==================== */

.alert {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: var(--shadow-sm);
}

.alert-success {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    color: #065f46;
}

.alert-danger {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    color: #991b1b;
}

.alert-warning {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
}

.alert-info {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #1e40af;
}

/* ==================== BADGES ==================== */

.badge {
    border-radius: 12px;
    padding: 4px 12px;
    font-weight: 500;
}

/* ==================== MODAL ==================== */

.modal-content {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 2px solid #f1f5f9;
}

.modal-footer {
    border-top: 2px solid #f1f5f9;
}

/* ==================== NAVBAR ==================== */

.navbar {
    box-shadow: var(--shadow-sm);
}

.navbar-brand {
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ==================== PAGINATION ==================== */

.pagination {
    gap: 4px;
}

.page-link {
    border-radius: var(--border-radius);
    border: none;
    color: var(--dark-text);
    transition: var(--transition);
}

.page-link:hover {
    background: var(--primary-color);
    color: white;
}

.page-item.active .page-link {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
}

/* ==================== BREADCRUMB ==================== */

.breadcrumb {
    background: transparent;
    padding: 12px 0;
}

.breadcrumb-item a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

.breadcrumb-item a:hover {
    color: var(--secondary-color);
}

/* ==================== RESPONSIVE ==================== */

/* Mobile first */
@media (max-width: 576px) {
    .card-img-top {
        height: 200px;
    }
    
    h1 {
        font-size: 1.75rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 8px;
    }
}

/* Tablet */
@media (min-width: 768px) and (max-width: 991px) {
    .card-img-top {
        height: 220px;
    }
}

/* Desktop */
@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
}

/* ==================== UTILITIES ==================== */

/* ==================== FEED LAYOUT ==================== */

.feed-container, .feed-wrapper, .feed-grid {
    width: 100%;
}

.feed-wrapper {
    max-width: 1260px;
    margin: 0 auto;
    padding: 0 16px;
}

.feed-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    align-items: start;
}

.feed-main-column,
.feed-sidebar-column {
    min-width: 0;
}

@media (min-width: 641px) {
    .feed-grid {
        grid-template-columns: 2fr 1fr;
    }
}

@media (min-width: 1025px) {
    .feed-grid {
        grid-template-columns: 2fr 1fr 1fr;
    }
}

.text-gradient {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hover-scale {
    transition: var(--transition);
}

.hover-scale:hover {
    transform: scale(1.05);
}

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

/* ==================== ANIMATIONS ==================== */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

.fade-in {
    animation: fadeIn 0.5s ease;
}

.slide-up {
    animation: slideUp 0.5s ease;
}

/* ==================== DARK MODE SUPPORT ==================== */

@media (prefers-color-scheme: dark) {
    :root {
        --light-bg: #1e293b;
        --dark-text: #f1f5f9;
    }
    
    body {
        background: #0f172a;
        color: var(--dark-text);
    }
    
    .card {
        background: #1e293b;
        color: var(--dark-text);
    }
    
    .form-control, .form-select {
        background: #334155;
        color: var(--dark-text);
        border-color: #475569;
    }
}

/* ==================== ACCESSIBILITY ==================== */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus styles */
a:focus, button:focus, input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ==================== PRINT STYLES ==================== */

@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        color: black;
        background: white;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
