/* 
 * Perfect Answer - Frontend CSS
 * Modern responsive design for the question and answer system
 */

/* Root Variables */
:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-radius: 0.375rem;
    --transition: all 0.3s ease;
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow-md: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
}

/* Global Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 1rem;
}

.display-4 {
    font-weight: 700;
}

/* Links */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: #0056b3;
    text-decoration: none;
}

/* Buttons */
.btn {
    font-weight: 500;
    border-radius: var(--border-radius);
    transition: var(--transition);
    border: none;
    padding: 0.5rem 1rem;
}

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

.btn-primary {
    background: linear-gradient(45deg, var(--primary-color), #0056b3);
}

.btn-primary:hover {
    background: linear-gradient(45deg, #0056b3, var(--primary-color));
}

/* Cards */
.card {
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid #e9ecef;
}

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

.card-title {
    margin-bottom: 0.75rem;
}

.card-title a {
    color: inherit;
}

.card-title a:hover {
    color: var(--primary-color);
}

/* Navigation */
.navbar {
    padding: 1rem 0;
    box-shadow: var(--shadow-sm);
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.5rem;
}

.navbar-nav .nav-link {
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.navbar-nav .nav-link.active {
    background-color: rgba(255, 255, 255, 0.2);
    font-weight: 600;
}

/* Dropdown */
.dropdown-menu {
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    border: none;
    padding: 0.5rem 0;
}

.dropdown-item {
    padding: 0.5rem 1rem;
    transition: var(--transition);
}

.dropdown-item:hover {
    background-color: var(--light-color);
    color: var(--dark-color);
}

.dropdown-item.active {
    background-color: var(--primary-color);
    color: white;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #dee2e6;
}

.hero h1 {
    background: linear-gradient(45deg, var(--primary-color), #0056b3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Search Form */
.input-group-lg .form-control {
    font-size: 1.1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
}

.input-group-lg .btn {
    padding: 0.75rem 1.5rem;
    font-size: 1.1rem;
}

/* Search Results */
.search-highlight {
    background-color: #fff3cd;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-weight: 500;
}

/* Questions List */
.question-card {
    transition: var(--transition);
    margin-bottom: 1.5rem;
}

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

.question-card .card-title {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.question-card .card-text {
    margin-bottom: 0.75rem;
}

/* Tags */
.tags {
    margin-bottom: 0.5rem;
}

.tags .badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 1rem;
    margin-right: 0.25rem;
    margin-bottom: 0.25rem;
}

/* Category Badge */
.category-badge .badge {
    font-size: 0.8rem;
    padding: 0.375rem 0.75rem;
    border-radius: 1rem;
}

/* Sidebar */
.sidebar-section {
    background: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

.sidebar-title {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--dark-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

/* Categories List */
.categories-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.category-item {
    background: var(--light-color);
    color: var(--dark-color);
    transition: var(--transition);
    border: 1px solid #e9ecef;
}

.category-item:hover {
    background: #e9ecef;
    color: var(--dark-color);
    text-decoration: none;
}

.category-item.active {
    background: var(--primary-color);
    color: white;
}

.category-item .badge {
    font-size: 0.75rem;
}

/* Featured Questions */
.featured-question,
.popular-question {
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 0.75rem;
}

.featured-question:last-child,
.popular-question:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.featured-question h6,
.popular-question h6 {
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
    line-height: 1.3;
}

.featured-question a,
.popular-question a {
    color: var(--dark-color);
}

.featured-question a:hover,
.popular-question a:hover {
    color: var(--primary-color);
}

/* Pagination */
.pagination {
    margin-top: 2rem;
}

.page-link {
    color: var(--primary-color);
    border: 1px solid #dee2e6;
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius);
    margin: 0 0.125rem;
    transition: var(--transition);
}

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

.page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Question Detail Page */
.question-detail {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 2rem;
    margin-bottom: 2rem;
}

.question-meta {
    background: var(--light-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.answer-section {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 2rem;
}

.answer-header {
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.short-answer {
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
    border-left: 4px solid var(--primary-color);
}

.short-answer h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.detailed-answer {
    line-height: 1.8;
    font-size: 1.05rem;
}

.detailed-answer h4 {
    color: var(--dark-color);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.detailed-answer ul,
.detailed-answer ol {
    margin-bottom: 1.5rem;
}

.detailed-answer li {
    margin-bottom: 0.5rem;
}

/* Answer Vote Buttons */
.answer-votes {
    background: var(--light-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-top: 2rem;
    text-align: center;
}

.vote-btn {
    margin: 0 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-weight: 500;
    transition: var(--transition);
}

.vote-btn:hover {
    transform: translateY(-2px);
}

.vote-btn.btn-success:hover {
    background: #218838;
}

.vote-btn.btn-danger:hover {
    background: #c82333;
}

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

.alert-info {
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
    color: #0c5460;
}

.alert-warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    color: #856404;
}

.alert-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
}

.alert-danger {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
}

/* Footer */
footer {
    margin-top: auto;
    background: var(--dark-color) !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero {
        padding: 2rem 0;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .question-card .row {
        flex-direction: column;
    }
    
    .question-card .col-md-4 {
        text-align: left !important;
        margin-top: 1rem;
    }
    
    .sidebar-section {
        margin-bottom: 1rem;
    }
    
    .categories-list {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .category-item {
        flex: 1 1 calc(50% - 0.5rem);
        min-width: 120px;
    }
    
    .question-detail,
    .answer-section {
        padding: 1.5rem;
    }
    
    .navbar-nav {
        margin-top: 1rem;
    }
    
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
    }
}

@media (max-width: 576px) {
    .hero h1 {
        font-size: 1.75rem;
    }
    
    .categories-list {
        flex-direction: column;
    }
    
    .category-item {
        flex: none;
    }
    
    .question-detail,
    .answer-section {
        padding: 1rem;
    }
    
    .pagination {
        justify-content: center;
    }
    
    .page-link {
        padding: 0.375rem 0.5rem;
        font-size: 0.875rem;
    }
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border: 2px solid #ccc;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translate(-50%, -50%);
}

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

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* 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: 0;
}

/* Focus States */
.btn:focus,
.form-control:focus,
.page-link:focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    outline: 0;
}

/* Print Styles */
@media print {
    .navbar,
    .sidebar-section,
    .answer-votes,
    footer {
        display: none !important;
    }
    
    .container {
        max-width: none !important;
        padding: 0 !important;
    }
    
    .question-detail,
    .answer-section {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
    
    .card {
        break-inside: avoid;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #0056b3;
        --secondary-color: #495057;
    }
    
    .card {
        border: 2px solid #000;
    }
    
    .btn {
        border: 2px solid currentColor;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
} 