/* Custom CSS for PrepMate Webapp */
/* Feature: 012-profile-contact-ui */
/* Feature: 013-ui-cleanup-header - Content width expansion */

/* Mobile-first responsive design - 320px+ screens */

/* Content Width Expansion - 013-ui-cleanup-header */
.container {
    max-width: 90% !important;
}

/* Mobile Adjustment: Slightly narrower for readability */
@media (max-width: 768px) {
    .container {
        max-width: 95% !important;
    }
}

/* Global styles */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* Mobile breakpoint - 320px+ */
@media (max-width: 576px) {
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .navbar-brand {
        font-size: 1rem;
    }
    
    .btn {
        font-size: 0.875rem;
        padding: 0.375rem 0.75rem;
    }
}

/* Tablet breakpoint - 768px+ */
@media (min-width: 768px) {
    .container {
        max-width: 720px;
    }
}

/* Desktop breakpoint - 992px+ */
@media (min-width: 992px) {
    .container {
        max-width: 960px;
    }
}

/* Loading indicators */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner-border-lg {
    width: 3rem;
    height: 3rem;
}

/* Contact list styles */
.contact-card {
    cursor: pointer;
    transition: all 0.2s ease;
}

.contact-card:hover {
    background-color: #f8f9fa;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.contact-card-active {
    border-left: 4px solid var(--primary-color);
    background-color: #e7f1ff;
}

/* Message styles */
.message-container {
    max-height: 60vh;
    overflow-y: auto;
}

.message-user {
    background-color: #e7f1ff;
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
}

.message-assistant {
    background-color: #f8f9fa;
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
}

/* Fact styles */
.fact-card {
    border-left: 3px solid var(--info-color);
    background-color: #f8f9fa;
    transition: background-color 0.2s ease;
    border-radius: 0.375rem;
    font-size: 0.9rem;
    line-height: 1.4;
}

.fact-card:hover {
    background-color: #e9ecef;
}

.fact-message {
    margin-bottom: 0.5rem !important;
}

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

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

.char-counter.danger {
    color: var(--danger-color);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--secondary-color);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Error banner */
.error-banner {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1050;
    min-width: 300px;
    max-width: 90%;
}

/* Accessibility improvements */
.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 for keyboard navigation */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .navbar,
    .btn,
    footer {
        display: none;
    }
}

/* Sync Status Indicators - Feature: 012-realtime-message-display */
/* T016-T018: Visual feedback for optimistic UI updates */

.sync-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    margin-left: 0.5rem;
    min-width: 1.25rem;
}

/* T016: Pending state - message awaiting backend confirmation */
.sync-indicator.pending {
    opacity: 0.7;
    color: var(--info-color);
}

.message-pending {
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

/* T017: Confirmed state - message successfully synced */
.sync-indicator.confirmed {
    opacity: 1.0;
    color: var(--success-color);
}

/* T018: Failed state - sync error, needs retry */
.sync-indicator.failed {
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
    border-radius: 0.25rem;
    padding: 0.125rem 0.375rem;
    cursor: pointer;
    background-color: rgba(220, 53, 69, 0.1);
    font-size: 0.75rem;
    transition: all 0.2s ease;
}

.sync-indicator.failed:hover {
    background-color: rgba(220, 53, 69, 0.2);
    transform: scale(1.05);
}

.message-failed {
    border-left: 3px solid var(--danger-color) !important;
    background-color: rgba(220, 53, 69, 0.05);
}

/* Retry button styling */
.retry-btn {
    border: none;
    background: none;
    padding: 0;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.retry-btn:hover {
    text-decoration: underline;
}
