/*
 * AVOTE - REFINED STYLESHEET
 * Author: Gemini
 * Date: 27/09/2025
 * Description: A mobile-first, clean, and responsive stylesheet.
*/

/* 1. CSS Variables & Root Styles */
:root {
    --primary-color: #3b82f6; /* blue-500 */
    --success-color: #22c55e; /* green-500 */
    --danger-color: #ef4444; /* red-500 */
    --light-gray: #f9fafb; /* gray-50 */
    --medium-gray: #e5e7eb; /* gray-200 */
    --dark-gray: #4b5563; /* gray-600 */
    --text-color: #1f2937; /* gray-800 */
    --border-radius: 0.5rem; /* 8px */
    --card-padding: 0.5rem; /* 8px */
    --transition-speed: 0.2s;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--light-gray);
    color: var(--text-color);
    /* flex-column min-vh-100 is handled in base.html */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

main {
    flex-grow: 1;
}

/* 2. Components Styling */
/* Navbar */
.navbar {
    box-shadow: var(--shadow-md);
}

.navbar-brand {
    letter-spacing: -0.5px;
}

/* Main Content Card */
.main-content-card {
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    background-color: white;
}

/* Code Card */
.code-card {
    border: 1px solid var(--medium-gray);
    background: white;
    border-radius: var(--border-radius);
    height: 100%;
    cursor: pointer;
    overflow: hidden;
    position: relative;
    transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

.code-card .card-body {
    padding: var(--card-padding);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.code-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    text-align: center;
    line-height: 1.2;
    word-break: break-all;
}

/* Vote Stats */
.vote-stats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.vote-stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.vote-stat-item.positive {
    color: var(--success-color);
}

.vote-stat-item.negative {
    color: var(--danger-color);
}

.score-badge {
    font-weight: 700;
    font-size: 0.875rem;
    min-width: 32px;
}

/* Voted State Indicators */
.code-card.voted-up {
    border-left: 4px solid var(--success-color);
}

.code-card.voted-down {
    border-left: 4px solid var(--danger-color);
}

.vote-status-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease;
}

.vote-status-badge.liked {
    background: var(--success-color);
    color: white;
}

.vote-status-badge.disliked {
    background: var(--danger-color);
    color: white;
}

/* Card Actions (for hover/tap) */
.card-actions {
    opacity: 0;
    visibility: hidden;
    transform: translateY(100%);
    transition: all var(--transition-speed) ease;
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 2;
}

.card-actions .btn {
    border-radius: 0;
    font-size: 12px;
    padding: 8px 12px;
    border: none;
    font-weight: 500;
}

.card-actions .btn:first-child {
    border-bottom-left-radius: var(--border-radius);
}

.card-actions .btn:last-child {
    border-bottom-right-radius: var(--border-radius);
}

/* Card active state for mobile tap */
.code-card.is-active .card-actions {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

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

/* Filter Bar */
.filter-bar {
    background: var(--light-gray);
    border-radius: var(--border-radius);
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid var(--medium-gray);
}

.filter-bar .form-control,
.filter-bar .form-select,
.filter-bar .btn {
    border-radius: 6px;
    font-size: 14px;
}

.filter-bar .form-control:focus,
.filter-bar .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Footer */
footer a:hover {
    color: var(--primary-color) !important;
    text-decoration: underline !important;
}

/* Toast Animations */
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* 3. Responsive Design */
@media (min-width: 768px) {
    /* Enable hover effects only on non-touch devices/large screens */
    .code-card:hover {
        transform: translateY(-4px);
        box-shadow: var(--shadow-md);
    }

    .code-card:hover .card-actions {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    display: inline-block;
}

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

.skeleton-text { height: 1em; margin-bottom: 0.5rem; width: 80%; }
.skeleton-badge { height: 20px; width: 40px; border-radius: 10px; }
.skeleton-card { height: 100%; min-height: 120px; }
