/* FIRST Connected Frontend Styles */

:root {
    --fc-primary: #0066cc;
    --fc-secondary: #ff6600;
    --fc-success: #28a745;
    --fc-danger: #dc3545;
    --fc-light: #f8f9fa;
    --fc-dark: #343a40;
    --fc-border: #dee2e6;
}

/* Signup Form */
.firstconnected-signup-container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 10px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.fc-proximity-dashboard {
    color: #000;
}

.firstconnected-signup-container h3 {
    color: var(--fc-primary);
    margin-top: 0;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--fc-primary);
}

.firstconnected-signup-container h3:first-of-type {
    margin-top: 0;
}

.firstconnected-form .form-group {
    margin-bottom: 1.5rem;
}

.firstconnected-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--fc-dark);
}

.firstconnected-form .required {
    color: var(--fc-danger);
}

.firstconnected-form .form-control {
    width: 100%;
    padding: 0;
    border: 1px solid var(--fc-border);
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.firstconnected-form .form-control:focus {
    outline: none;
    border-color: var(--fc-primary);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.firstconnected-form select.form-control[multiple] {
    min-height: 120px;
}

.firstconnected-form textarea.form-control {
    resize: vertical;
}

.firstconnected-form small {
    display: block;
    margin-top: 0rem;
    color: #6c757d;
    font-size: 0.875rem;
}

/* Checkbox groups */
.firstconnected-form .checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.firstconnected-form .checkbox-group label {
    display: flex;
    align-items: center;
    font-weight: normal;
    margin-bottom: 0;
}

.firstconnected-form .checkbox-group input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
}

/* Range slider */
.firstconnected-form input[type="range"] {
    width: 100%;
    height: 6px;
    background: var(--fc-border);
    outline: none;
    border-radius: 3px;
}

.firstconnected-form input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--fc-primary);
    cursor: pointer;
    border-radius: 50%;
}

.firstconnected-form input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--fc-primary);
    cursor: pointer;
    border-radius: 50%;
    border: none;
}

.firstconnected-form output {
    font-weight: 600;
    color: var(--fc-primary);
}

/* Mentor-only fields */
.firstconnected-form .mentor-only {
    display: none;
}

.firstconnected-form .btn {
    padding: 0 2rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.firstconnected-form .btn-primary {
    background: var(--fc-primary);
    color: #fff;
}

.firstconnected-form .btn-primary:hover {
    background: #0052a3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.signup-message {
    margin-top: 0;
    padding: 1rem;
    border-radius: 4px;
    display: none;
}

.signup-message.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    display: block;
}

.signup-message.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    display: block;
}

/* Messaging Interface */
.firstconnected-messaging-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
}

.messaging-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    min-height: 600px;
}

.connections-sidebar {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.connections-sidebar h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.25rem;
    color: var(--fc-dark);
}

#connections-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.connection-item {
    padding: 1rem;
    margin-bottom: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    border: 1px solid #cbd5e1; /* stronger border for contrast */
    background: #ffffff; /* solid white background */
    color: #111827; /* near-black text */
}

.connection-item:hover {
    background: #f1f5f9; /* slate-100 */
}

.connection-item.active {
    background: var(--fc-primary);
    color: #fff;
    border-color: var(--fc-primary);
}
.connection-item.active .connection-name,
.connection-item.active .connection-role {
    color: #ffffff;
}

.connection-item .connection-name {
    font-weight: 600;
    display: block;
    margin-bottom: 0.25rem;
    color: #111827;
}

.connection-item .connection-role {
    font-size: 0.875rem;
    color: #4b5563; /* slate-600 */
}

.connection-item .unread-badge {
    display: inline-block;
    background: var(--fc-danger);
    color: #fff;
    border-radius: 12px;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.messages-main {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

#message-thread {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 1.5rem;
    max-height: 500px;
    padding: 16px 12px;
    border: 1px solid var(--fc-border);
    border-radius: 16px;
    background: #f5f5f7; /* iOS chat-style light background */
}

.read-only-banner {
    background: #fef3c7; /* amber-100 */
    border: 1px solid #f59e0b; /* amber-500 */
    color: #92400e; /* amber-800 */
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.no-conversation {
    text-align: center;
    color: #6c757d;
    padding: 2rem;
}

.message {
    margin: 10px 0;
    display: flex;
    flex-direction: column;
}

.message.own-message {
    align-items: flex-end;
}

.message.other-message {
    align-items: flex-start;
}

.message-header {
    font-size: 0.75rem;
    color: #6b7280; /* slate-500 */
    margin: 0 10px 4px;
}

.message.own-message .message-header {
    display: none; /* iMessage hides sender for own bubbles */
}

.message-content {
    position: relative;
    padding: 10px 14px;
    border-radius: 18px;
    max-width: 75%;
    word-wrap: break-word;
    line-height: 1.35;
    box-shadow: 0 1px 1px rgba(0,0,0,0.03);
}

/* Incoming (left) bubble */
.message.other-message .message-content {
    background: #e5e5ea; /* iMessage light gray */
    color: #111827;
}
.message.other-message .message-content:after {
    content: "";
    position: absolute;
    left: -6px;
    bottom: 0;
    width: 12px; height: 12px;
    background: #e5e5ea;
    border-bottom-left-radius: 10px;
    transform: translateY(-2px) rotate(45deg);
    box-shadow: -1px 1px 0 rgba(0,0,0,0.03);
}

/* Outgoing (right) bubble */
.message.own-message .message-content {
    background: #0b93f6; /* iMessage blue */
    color: #ffffff;
}
.message.own-message .message-content:after {
    content: "";
    position: absolute;
    right: -6px;
    bottom: 0;
    width: 12px; height: 12px;
    background: #0b93f6;
    border-bottom-right-radius: 10px;
    transform: translateY(-2px) rotate(45deg);
    box-shadow: 1px 1px 0 rgba(0,0,0,0.03);
}

.message-date {
    font-size: 0.7rem;
    color: #6b7280; /* slate-500 */
    margin-top: 4px;
    margin-left: 10px;
}
.message.own-message .message-date {
    text-align: right;
    margin-right: 10px;
}

/* Links in messages */
.message-content a {
    color: inherit;
    text-decoration: underline;
    transition: opacity 0.2s;
}

.message-content a:hover {
    opacity: 0.8;
}

/* For incoming messages (gray), make links darker for better contrast */
.message.other-message .message-content a {
    color: #1d4ed8; /* blue-700 for contrast on gray */
}

/* For outgoing messages (blue), keep white but underlined */
.message.own-message .message-content a {
    color: #ffffff;
    text-decoration: underline;
    font-weight: 500;
}

/* Message actions (e.g., remove) */
.message-actions { margin-top: 2px; opacity: 0; transition: opacity .15s ease; }
.message:hover .message-actions { opacity: 1; }
.message-actions .btn-link {
    background: none; border: none; cursor: pointer; padding: 0 10px; font-size: 0.75rem;
    color: #2563eb; text-decoration: none;
}
.message-actions .btn-link:hover, .message-actions .btn-link:focus { color: #1e40af; text-decoration: underline; outline: none; }

#message-input-container {
    border-top: 1px solid var(--fc-border);
    padding-top: 1rem;
}

.message-input-wrapper {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.message-input-wrapper textarea {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--fc-border);
    border-radius: 4px;
    resize: none;
    font-family: inherit;
}

.message-input-wrapper button {
    padding: 0.75rem 2rem;
    background: var(--fc-primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s;
}

.message-input-wrapper button:hover {
    background: #0052a3;
}

/* Map */
.firstconnected-map-container {
    margin: 2rem auto;
    max-width: 1200px;
}

.map-filters {
    background: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.map-filters label {
    font-weight: 600;
    color: var(--fc-dark);
}

.map-filters select {
    margin-left: 0.5rem;
    padding: 0.5rem;
    border: 1px solid var(--fc-border);
    border-radius: 4px;
}

#firstconnected-map {
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.map-legend {
    background: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.map-legend h4 {
    margin-top: 0;
    margin-bottom: 1rem;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.legend-marker {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-right: 0.5rem;
    border: 2px solid #fff;
    box-shadow: 0 0 4px rgba(0,0,0,0.3);
}

.legend-marker.mentor {
    background: #0066cc;
}

.legend-marker.mentee {
    background: #ff6600;
}

.legend-marker.both {
    background: #28a745;
}

/* Language Switcher */
.firstconnected-language-switcher select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--fc-border);
    border-radius: 4px;
}

/* Loading States */
.loading {
    text-align: center;
    padding: 1rem;
    color: #6c757d;
}

.loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Proximity Dashboard */
.fc-proximity-dashboard {
    margin: 10px 0 20px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fafafa;
}

.fc-proximity-dashboard strong {
    color: var(--fc-dark);
    font-size: 1rem;
}

.fc-view-map-link {
    color: var(--fc-primary);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s;
}

.fc-view-map-link:hover {
    color: #0052a3;
    text-decoration: underline;
}

.fc-proximity-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 6px;
}

.fc-proximity-group {
    flex: 1 1 280px;
    min-width: 0; /* prevent flex overflow */
}

.fc-proximity-group > div:first-child {
    font-size: 12px;
    font-weight: 600;
    color: #777;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.fc-proximity-card {
    flex: 1;
    padding: 8px 10px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    text-align: center;
    transition: box-shadow 0.2s, transform 0.2s;
}

.fc-proximity-card:hover {
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.fc-proximity-card > div:first-child {
    font-size: 11px;
    color: #888;
    margin-bottom: 2px;
    font-weight: 500;
}

.fc-proximity-card > div:last-child {
    font-size: 18px;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    .messaging-layout {
        grid-template-columns: 1fr;
    }
    
    .connections-sidebar {
        max-height: 300px;
        overflow-y: auto;
    }
    
    .map-filters {
        flex-direction: column;
        gap: 1rem;
    }
    
    .map-filters label {
        display: block;
    }
    
    .map-filters select {
        margin-left: 0;
        margin-top: 0.5rem;
        width: 100%;
    }
    
    .fc-proximity-stats {
        flex-direction: column;
    }
    
    .fc-proximity-group {
        flex: 1 1 auto;
    }
    
    .fc-proximity-dashboard {
        padding: 10px;
    }
}
