/* General Styles */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #ffffff;
    position: relative;
    line-height: 1.6;
}

/* Skip Link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #4a90e2;
    color: white;
    padding: 8px;
    z-index: 100;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
    outline: 3px solid #4a90e2;
    outline-offset: 2px;
}

/* Background Pattern Overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(45deg, rgba(255, 255, 255, 0.02) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(255, 255, 255, 0.02) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.02) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.02) 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    pointer-events: none;
    z-index: 0;
}

.container {
    flex: 1;
    position: relative;
    z-index: 1;
    padding: 1rem 1rem;
}

/* Rate Limit Countdown Styles */
.countdown-container {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    color: #ffffff;
    transition: all 0.3s ease;
}

.countdown-container.warning {
    background: rgba(255, 193, 7, 0.2);
    border-color: rgba(255, 193, 7, 0.3);
}

.countdown-value {
    font-family: monospace;
    font-weight: 500;
}

/* Card Styles */
.card {
    background: rgba(255, 255, 255, 0.1);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    border-radius: 12px;
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}

.card:hover, .card:focus-within {
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.5);
    border-color: rgba(255, 255, 255, 0.3);
}

.card-body {
    color: #ffffff;
}

.card-text {
    color: #ffffff;
    font-size: 1rem;
    line-height: 1.6;
}

/* Memory Card Styles */
.memory-card {
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    margin-bottom: 1.5rem;
}

.memory-card:hover, .memory-card:focus-within {
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.5);
    border-color: rgba(255, 255, 255, 0.3);
}

.memory-metadata {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 1rem;
    margin-top: 1rem;
}

.memory-content {
    color: #ffffff;
}

/* Tag Styles */
.badge {
    font-size: 0.85em;
    padding: 0.5em 0.8em;
    margin-right: 0.5em;
    margin-bottom: 0.5em;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    transition: all 0.2s ease;
    color: #ffffff;
}

.badge:hover, .badge:focus {
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.badge .btn-close {
    font-size: 0.7em;
    margin-left: 0.5em;
}

/* Form Styles */
.form-control {
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-size: 1rem;
    padding: 0.75rem 1rem;
}

.form-control:focus {
    background: rgba(255, 255, 255, 0.2);
    border-color: #4a90e2;
    color: #ffffff;
    box-shadow: 0 0 0 0.25rem rgba(74, 144, 226, 0.25);
}

.form-control::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

textarea.form-control {
    min-height: 120px;
}

/* Button Styles */
.btn {
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 1rem;
}

.btn:focus {
    outline: 3px solid #4a90e2;
    outline-offset: 2px;
    box-shadow: none;
}

.btn-primary {
    background: rgba(74, 144, 226, 0.8);
    border-color: rgba(74, 144, 226, 0.6);
    color: #ffffff;
}

.btn-primary:hover, .btn-primary:focus {
    background: rgba(74, 144, 226, 0.9);
    border-color: rgba(74, 144, 226, 0.8);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.25);
}

.btn-danger {
    background: rgba(220, 53, 69, 0.8);
    border-color: rgba(220, 53, 69, 0.6);
    color: #ffffff;
}

.btn-danger:hover, .btn-danger:focus {
    background: rgba(220, 53, 69, 0.9);
    border-color: rgba(220, 53, 69, 0.8);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.25);
}

/* Search Results */
.search-result {
    border-left: 4px solid #4a90e2;
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.search-result:hover, .search-result:focus-within {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-left-width: 6px;
}

.similarity-score {
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.8);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* Focus Visible Polyfill */
:focus:not(:focus-visible) {
    outline: none;
}

:focus-visible {
    outline: 3px solid #4a90e2;
    outline-offset: 2px;
}

/* Text Styles */
.memory-card .text-muted,
.memory-card .text-muted small {
    color: rgba(255, 255, 255, 0.85) !important;
}

/* High Contrast Mode Support */
@media (forced-colors: active) {
    .card,
    .btn,
    .form-control {
        border: 2px solid currentColor;
    }
}

/* Reduced Motion */
@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;
    }
}
