/* Custom styles for VoteApp - Mobile First Responsive Design */

/* Base styles - Mobile first */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --border-radius: 0.375rem;
    --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --transition: all 0.15s ease-in-out;
}

* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    background-color: var(--light-color);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    font-size: 0.9rem;
    overflow-x: hidden;
}

/* Skip to content link for accessibility */
.visually-hidden-focusable:focus {
    z-index: 1050;
}

/* Navigation Enhancements */
.navbar {
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.25rem;
    transition: var(--transition);
}

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

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

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.navbar-nav .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 1px;
}

.navbar-toggler {
    border: none;
    padding: 0.25rem 0.5rem;
    transition: var(--transition);
}

.navbar-toggler:focus {
    box-shadow: none;
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

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

/* Theme Cards - Mobile First */
.theme-card {
    border: none;
    border-radius: var(--border-radius);
    transition: var(--transition);
    box-shadow: var(--box-shadow);
    height: 100%;
    overflow: hidden;
}

.theme-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.theme-card .card-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

.theme-card .card-title {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 0.75rem;
}

.theme-card .card-title a {
    color: var(--dark-color);
    text-decoration: none;
    transition: var(--transition);
    display: block;
}

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

.theme-card .card-text {
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--secondary-color);
    flex-grow: 1;
    margin-bottom: 1rem;
}

.theme-card .card-footer {
    background: transparent;
    border: none;
    padding: 0;
    margin-top: auto;
}

/* Form Styling - Mobile Optimized */
.form-control,
.form-select {
    border-radius: var(--border-radius);
    border: 1px solid #ced4da;
    transition: var(--transition);
    font-size: 1rem;
    padding: 0.75rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
    outline: none;
}

.form-control.is-valid {
    border-color: var(--success-color);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='m2.3 6.73.94-.94 1.38 1.38'/%3e%3c/svg%3e");
}

.form-control.is-invalid {
    border-color: var(--danger-color);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.8 4.6 2.4 2.4m0-2.4L5.8 7'/%3e%3c/svg%3e");
}

.form-label {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.form-text {
    font-size: 0.875rem;
    color: var(--secondary-color);
}

/* Button Enhancements */
.btn {
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: var(--transition);
    border: 1px solid transparent;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    line-height: 1.5;
    position: relative;
    overflow: hidden;
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
}

.btn:active {
    transform: translateY(0);
}

.btn:focus {
    outline: 2px solid transparent;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

/* Touch device button feedback */
.touch-device .btn-touch-active {
    background-color: rgba(0, 0, 0, 0.1);
    transform: scale(0.98);
}

/* Vote Statistics */
.vote-stats .badge {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 20px;
}

.vote-buttons {
    margin: 10px 0;
}

.vote-count {
    font-weight: bold;
    margin: 0 10px;
}

/* Alert Styling */
.alert {
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Card Enhancements */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.card-header {
    border-radius: 10px 10px 0 0 !important;
    border-bottom: none;
    font-weight: 600;
}

/* Statistics */
.stat-item h3 {
    margin-bottom: 0.25rem;
}

.stats-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
    padding: 20px;
    margin: 10px 0;
}

/* Comments */
.comment-section {
    margin-top: 20px;
    border-top: 1px solid #dee2e6;
    padding-top: 20px;
}

.comment-item {
    border-bottom: 1px solid #f8f9fa;
    padding: 15px 0;
}

/* Admin Panel */
.admin-panel {
    background-color: #f8f9fa;
    border-left: 4px solid #007bff;
    padding: 15px;
    margin: 20px 0;
}

/* Responsive Design - Mobile First Approach */

/* Extra Small devices (phones, less than 576px) */
@media (max-width: 575.98px) {
    body {
        font-size: 0.875rem;
    }
    
    .container-xl {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .navbar-nav .nav-link:last-child {
        border-bottom: none;
    }
    
    .card {
        margin-bottom: 1rem;
        border-radius: var(--border-radius);
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .card-title {
        font-size: 1rem;
        line-height: 1.3;
    }
    
    .btn {
        font-size: 0.875rem;
        padding: 0.625rem 1rem;
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .btn-group .btn {
        width: auto;
        margin-bottom: 0;
    }
    
    .vote-stats .badge {
        display: block;
        margin-bottom: 0.25rem;
        width: 100%;
        padding: 0.5rem;
        font-size: 0.875rem;
    }
    
    .breadcrumb {
        font-size: 0.8rem;
        padding: 0.5rem 0;
    }
    
    .breadcrumb-item {
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .alert {
        margin-left: -1rem;
        margin-right: -1rem;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    .table-responsive {
        border: none;
    }
    
    .table-responsive table {
        font-size: 0.8rem;
    }
    
    /* Footer adjustments */
    footer .row > div {
        text-align: center !important;
        margin-bottom: 0.5rem;
    }
    
    footer .btn-group {
        justify-content: center;
    }
}

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767.98px) {
    body {
        font-size: 0.9rem;
    }
    
    .navbar-brand {
        font-size: 1.25rem;
    }
    
    .theme-card .card-title {
        font-size: 1.1rem;
    }
    
    .btn {
        font-size: 0.9rem;
    }
    
    .vote-number {
        font-size: 2rem;
    }
    
    .stat-item h3 {
        font-size: 1.75rem;
    }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .navbar-brand {
        font-size: 1.4rem;
    }
    
    .theme-card .card-title {
        font-size: 1.15rem;
    }
    
    .theme-card .card-text {
        font-size: 0.9rem;
    }
    
    .btn {
        width: auto;
        margin-bottom: 0;
    }
    
    .vote-stats .badge {
        display: inline-block;
        width: auto;
        margin-bottom: 0;
    }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
    body {
        font-size: 1rem;
    }
    
    .navbar-brand {
        font-size: 1.5rem;
    }
    
    .theme-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 0.75rem 1.5rem rgba(0, 0, 0, 0.15);
    }
    
    .card-body {
        padding: 1.5rem;
    }
    
    .btn:hover {
        transform: translateY(-2px);
    }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .container-xl {
        max-width: 1200px;
    }
    
    .theme-card .card-body {
        padding: 1.75rem;
    }
    
    .theme-card .card-title {
        font-size: 1.25rem;
    }
}

/* Ultra-wide screens (1400px and up) */
@media (min-width: 1400px) {
    .container-xl {
        max-width: 1320px;
    }
}

/* Tablet specific adjustments */
@media (min-width: 768px) and (max-width: 991px) {
    .theme-card .card-title {
        font-size: 1.15rem;
    }
    
    .theme-card .card-text {
        font-size: 0.95rem;
    }
}

/* Loading states */
.btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Form validation styling */
.is-valid {
    border-color: #28a745;
}

.is-invalid {
    border-color: #dc3545;
}

/* Progress bars */
.progress {
    background-color: #e9ecef;
    border-radius: 10px;
}

.progress-bar {
    border-radius: 10px;
}

/* Breadcrumb styling */
.breadcrumb {
    background-color: transparent;
    padding: 0;
    margin-bottom: 1rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    color: #6c757d;
}
/* M
obile-specific enhancements */
@media (hover: none) and (pointer: coarse) {
    /* Touch device optimizations */
    .btn {
        min-height: 44px; /* Apple's recommended touch target size */
        padding: 0.75rem 1rem;
    }
    
    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .form-control,
    .form-select {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .card:hover {
        transform: none; /* Disable hover effects on touch devices */
    }
    
    .theme-card:hover {
        transform: none;
        box-shadow: var(--box-shadow);
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .navbar-brand i,
    .btn i {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .btn:hover,
    .theme-card:hover,
    .nav-link:hover {
        transform: none;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --light-color: #212529;
        --dark-color: #f8f9fa;
        --border-color: #495057;
    }
    
    body {
        background-color: var(--light-color);
        color: var(--dark-color);
    }
    
    .card {
        background-color: #343a40;
        border-color: var(--border-color);
    }
    
    .form-control,
    .form-select {
        background-color: #495057;
        border-color: var(--border-color);
        color: var(--dark-color);
    }
    
    .form-control:focus,
    .form-select:focus {
        background-color: #495057;
        border-color: var(--primary-color);
        color: var(--dark-color);
    }
}

/* Print styles */
@media print {
    .navbar,
    .btn,
    footer,
    #back-to-top,
    .alert-container {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
        font-size: 12pt;
        line-height: 1.4;
    }
    
    .card {
        border: 1px solid #ccc !important;
        box-shadow: none !important;
        page-break-inside: avoid;
    }
    
    .theme-card {
        margin-bottom: 1rem;
    }
    
    a {
        text-decoration: underline;
    }
    
    a[href^="http"]:after {
        content: " (" attr(href) ")";
        font-size: 10pt;
        color: #666;
    }
}

/* Accessibility enhancements */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.visually-hidden-focusable:focus,
.visually-hidden-focusable:focus-within {
    position: static !important;
    width: auto !important;
    height: auto !important;
    padding: inherit !important;
    margin: inherit !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: normal !important;
}

/* Focus indicators */
.btn:focus-visible,
.nav-link:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

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

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Back to top button */
#back-to-top {
    transition: var(--transition);
    opacity: 0.8;
}

#back-to-top:hover {
    opacity: 1;
    transform: translateY(-2px);
}

/* Alert enhancements */
.alert {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    border-left: 4px solid;
}

.alert-success {
    border-left-color: var(--success-color);
}

.alert-danger {
    border-left-color: var(--danger-color);
}

.alert-warning {
    border-left-color: var(--warning-color);
}

.alert-info {
    border-left-color: var(--info-color);
}

/* Utility classes for responsive design */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

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

.aspect-ratio-16-9 {
    aspect-ratio: 16 / 9;
}

.aspect-ratio-4-3 {
    aspect-ratio: 4 / 3;
}

.aspect-ratio-1-1 {
    aspect-ratio: 1 / 1;
}

/* Smooth scrolling for anchor links */
html {
    scroll-padding-top: 80px; /* Account for fixed navbar */
}

/* Enhanced focus management */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-color);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: var(--border-radius);
    z-index: 1000;
    transition: var(--transition);
}

.skip-link:focus {
    top: 6px;
}

/* Performance optimizations */
.theme-card,
.btn,
.nav-link {
    will-change: transform;
}

/* Prevent layout shift */
img {
    height: auto;
    max-width: 100%;
}

.card-img-top {
    aspect-ratio: 16 / 9;
    object-fit: cover;
}/
* Enhanced Interactive Features CSS */

/* Animation classes for scroll-triggered animations */
.animate-ready {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-in {
    opacity: 1;
    transform: translateY(0);
}

/* Enhanced alert system */
.enhanced-alert {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    margin-bottom: 1rem;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
}

.enhanced-alert.alert-show {
    opacity: 1;
    transform: translateY(0);
}

.enhanced-alert.alert-hide {
    opacity: 0;
    transform: translateY(-20px);
    margin-bottom: 0;
    max-height: 0;
    padding: 0;
    overflow: hidden;
}

.alert-icon {
    font-size: 1.25rem;
    margin-top: 0.125rem;
}

.alert-content {
    line-height: 1.5;
}

.alert-actions {
    margin-top: 0.75rem;
}

.alert-actions .btn {
    margin-right: 0.5rem;
    margin-bottom: 0.25rem;
}

/* Form loading states */
.form-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.form-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.form-loading::before {
    content: '送信中...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 1rem 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    z-index: 11;
    font-weight: 600;
    color: var(--primary-color);
}

/* Enhanced validation feedback */
.validation-summary {
    animation: slideInDown 0.3s ease;
    border-left: 4px solid var(--danger-color);
}

.validation-summary h6 {
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.validation-summary ul {
    font-size: 0.9rem;
    padding-left: 1.25rem;
}

.validation-summary li {
    margin-bottom: 0.25rem;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Real-time validation feedback */
.form-control.is-valid,
.form-select.is-valid {
    border-color: var(--success-color);
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='m2.3 6.73.94-.94 1.38 1.38'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-color: var(--danger-color);
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.8 4.6 2.4 2.4m0-2.4L5.8 7'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.valid-feedback,
.invalid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    animation: fadeInUp 0.3s ease;
}

.valid-feedback {
    color: var(--success-color);
}

.invalid-feedback {
    color: var(--danger-color);
}

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

/* Offline indicator */
.offline {
    filter: grayscale(50%);
}

.offline::before {
    content: 'オフライン';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--warning-color);
    color: var(--dark-color);
    text-align: center;
    padding: 0.5rem;
    font-weight: 600;
    z-index: 1060;
    animation: slideInDown 0.3s ease;
}

/* Enhanced button states */
.btn-loading {
    position: relative;
    pointer-events: none;
}

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

/* Enhanced vote button animations */
.vote-btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.vote-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.vote-btn:active::before {
    width: 300px;
    height: 300px;
}

.vote-btn.vote-success {
    animation: voteSuccessEnhanced 1s ease;
}

@keyframes voteSuccessEnhanced {
    0% { transform: scale(1); }
    25% { transform: scale(1.05); box-shadow: 0 0 20px rgba(40, 167, 69, 0.5); }
    50% { transform: scale(1); }
    75% { transform: scale(1.05); box-shadow: 0 0 20px rgba(40, 167, 69, 0.5); }
    100% { transform: scale(1); }
}

/* Enhanced theme card interactions */
.theme-card {
    position: relative;
    overflow: hidden;
}

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

.theme-card:hover::before {
    left: 100%;
}

/* Keyboard navigation indicators */
.theme-card:focus-within {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Progress indicators */
.progress-ring {
    width: 40px;
    height: 40px;
    transform: rotate(-90deg);
}

.progress-ring-circle {
    fill: transparent;
    stroke: var(--primary-color);
    stroke-width: 3;
    stroke-dasharray: 113;
    stroke-dashoffset: 113;
    transition: stroke-dashoffset 0.3s ease;
}

/* Character counter enhancements */
.char-counter {
    font-size: 0.875rem;
    color: var(--secondary-color);
    transition: color 0.3s ease;
}

.char-counter.warning {
    color: var(--warning-color);
    font-weight: 600;
}

.char-counter.danger {
    color: var(--danger-color);
    font-weight: 600;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Gesture feedback */
.swipe-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 1rem 2rem;
    border-radius: var(--border-radius);
    font-size: 1.25rem;
    z-index: 1050;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.swipe-indicator.show {
    opacity: 1;
}

/* Enhanced accessibility */
.visually-hidden-focusable:focus {
    position: static !important;
    width: auto !important;
    height: auto !important;
    padding: 0.5rem 1rem !important;
    margin: 0 !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: normal !important;
    background: var(--primary-color);
    color: white;
    border-radius: var(--border-radius);
    z-index: 1060;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid currentColor;
    }
    
    .card {
        border: 2px solid var(--dark-color);
    }
    
    .form-control,
    .form-select {
        border: 2px solid var(--dark-color);
    }
}

/* Reduced data mode */
@media (prefers-reduced-data: reduce) {
    .theme-card::before,
    .vote-btn::before {
        display: none;
    }
    
    .animate-ready {
        opacity: 1;
        transform: none;
    }
}

/* Focus management */
.focus-trap {
    position: relative;
}

.focus-trap::before,
.focus-trap::after {
    content: '';
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* Loading skeleton */
.skeleton {
    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; }
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
    border-radius: 4px;
}

.skeleton-text:last-child {
    width: 60%;
}

/* Enhanced mobile interactions */
@media (hover: none) and (pointer: coarse) {
    .theme-card:hover::before {
        display: none;
    }
    
    .vote-btn:active {
        transform: scale(0.95);
    }
    
    .btn:active {
        transform: scale(0.98);
    }
    
    /* Larger touch targets */
    .btn-close {
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .navbar-toggler {
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Performance optimizations */
.theme-card,
.btn,
.alert,
.form-control {
    contain: layout style;
}

/* Smooth scrolling enhancements */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
    
    .smooth-scroll {
        scroll-behavior: smooth;
    }
}

/* Container query support (future-proofing) */
@supports (container-type: inline-size) {
    .theme-card {
        container-type: inline-size;
    }
    
    @container (max-width: 300px) {
        .theme-card .card-title {
            font-size: 0.9rem;
        }
        
        .theme-card .btn {
            font-size: 0.8rem;
            padding: 0.5rem;
        }
    }
}