/* ===== Reset & Base ===== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: #fff;
}

/* ===== Header & Navigation ===== */
header {
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo {
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
    text-decoration: none;
}

.logo span {
    color: #6c63ff;
}

nav {
    display: flex;
    gap: 2rem;
}

nav a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: color 0.2s;
}

nav a:hover {
    color: #fff;
}

/* ===== Main Content ===== */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem;
}

/* ===== Cards & Containers ===== */
.card {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.card-header h1 {
    color: #fff;
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.card-header p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
}

.card-body {
    padding: 1.5rem;
}

/* ===== Chat Components ===== */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 400px;
    max-height: 500px;
}

.message {
    display: flex;
    gap: 0.75rem;
    animation: fadeIn 0.3s ease;
}

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.message.assistant .message-avatar {
    background: linear-gradient(135deg, #6c63ff, #4834d4);
    color: #fff;
}

.message.user .message-avatar {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.message-content {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.875rem 1rem;
    border-radius: 12px;
    color: #fff;
    max-width: 80%;
    line-height: 1.5;
}

.message.user .message-content {
    background: #6c63ff;
}

/* ===== Chat Input ===== */
.chat-input-container {
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-input-wrapper {
    display: flex;
    gap: 0.75rem;
}

.chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0.875rem 1rem;
    color: #fff;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input:focus {
    border-color: #6c63ff;
}

.chat-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* ===== Buttons ===== */
.btn {
    background: #6c63ff;
    border: none;
    border-radius: 8px;
    padding: 0.875rem 1.5rem;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn:hover {
    background: #5a52d4;
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    background: rgba(108, 99, 255, 0.5);
    cursor: not-allowed;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* ===== Typography ===== */
h1, h2, h3 {
    color: #fff;
}

p {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
}

a {
    color: #6c63ff;
}

/* ===== Typing Indicator ===== */
.typing-indicator {
    display: flex;
    gap: 0.25rem;
    padding: 0.875rem 1rem;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

/* ===== Notifications ===== */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #10b981;
    color: #fff;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 4.7s forwards;
    z-index: 1000;
}

.notification.hidden {
    display: none;
}

.notification-icon {
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-icon svg {
    width: 14px;
    height: 14px;
}

.notification-content h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.125rem;
}

.notification-content p {
    font-size: 0.8rem;
    opacity: 0.9;
}

/* ===== Badges ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: #10b981;
    color: #fff;
}

.badge-info {
    background: rgba(108, 99, 255, 0.2);
    color: #6c63ff;
}

.saved-badge {
    background: #10b981;
    color: #fff;
    margin-top: 0.75rem;
}

.saved-badge svg {
    width: 12px;
    height: 12px;
}

/* ===== Hero Section (for index) ===== */
.hero {
    text-align: center;
    padding: 4rem 2rem;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.125rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ===== Feature Cards ===== */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    padding: 2rem;
}

.feature-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: transform 0.2s, border-color 0.2s;
}

.feature-card:hover {
    transform: translateY(-4px);
    border-color: rgba(108, 99, 255, 0.3);
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    margin-bottom: 0.5rem;
}

.feature-card p {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}

/* ===== Utilities ===== */
.text-muted {
    color: rgba(255, 255, 255, 0.6);
}

.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

/* ===== Page Header ===== */
.page-header {
    text-align: center;
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.page-header p {
    color: rgba(255, 255, 255, 0.6);
}

/* ===== Rolodex Page ===== */
.rolodex-filters {
    max-width: 1000px;
    margin: 0 auto 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.search-input {
    width: 100%;
    padding: 0.875rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: #6c63ff;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.theme-filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.theme-btn {
    padding: 0.4rem 0.875rem;
    border: 2px solid transparent;
    border-radius: 20px;
    font-size: 0.8rem;
    color: #fff;
    cursor: pointer;
    opacity: 0.7;
    transition: all 0.2s;
}

.theme-btn:hover {
    opacity: 0.9;
}

.theme-btn.active {
    opacity: 1;
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ===== Rolodex Stats ===== */
.rolodex-stats {
    max-width: 1000px;
    margin: 0 auto 1.5rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.stat-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0.75rem 1.25rem;
    text-align: center;
    min-width: 80px;
    border-bottom: 3px solid #6c63ff;
}

.stat-number {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
}

.stat-label {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== Rolodex Grid ===== */
.rolodex-grid {
    max-width: 1000px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
}

/* ===== Member Cards ===== */
.member-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, border-color 0.2s;
}

.member-card:hover {
    transform: translateY(-2px);
    border-color: rgba(108, 99, 255, 0.3);
}

.member-card-accent {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.member-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

.member-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}

.member-info {
    flex: 1;
    min-width: 0;
}

.member-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 0.125rem;
}

.member-role {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
}

.member-dept {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    margin: 0;
}

.member-themes {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.theme-tag {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    color: #fff;
    font-weight: 500;
}

.member-about {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1rem;
    margin-bottom: 0.5rem;
}

.about-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 0.5rem;
}

.about-content {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
    white-space: pre-wrap;
}

.about-content.collapsed {
    max-height: 100px;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
}

.expand-btn {
    background: none;
    border: none;
    color: #6c63ff;
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0.25rem 0;
}

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

.member-contact {
    display: flex;
    gap: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 0.75rem;
}

.member-contact a {
    color: #6c63ff;
    text-decoration: none;
    font-size: 0.8rem;
}

.member-contact a:hover {
    text-decoration: underline;
}

/* ===== States ===== */
.loading-state,
.empty-state,
.error-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1rem;
    color: rgba(255, 255, 255, 0.6);
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #6c63ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.empty-icon,
.error-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.75rem;
}

.error-state {
    color: #e74c3c;
}

/* ===== Rolodex Responsive ===== */
@media (max-width: 768px) {
    .rolodex-grid {
        grid-template-columns: 1fr;
    }
    
    .page-header h1 {
        font-size: 1.5rem;
    }
    
    .stat-item {
        min-width: 70px;
        padding: 0.5rem 0.75rem;
    }
    
    .stat-number {
        font-size: 1.25rem;
    }
}