/* MThread Messenger - Lumina Noir Design System */

:root {
    /* Colors from DESIGN.md */
    --surface: #121416;
    --surface-dim: #121416;
    --surface-bright: #37393b;
    --surface-container-lowest: #0c0e10;
    --surface-container-low: #1a1c1e;
    --surface-container: #1e2022;
    --surface-container-high: #282a2c;
    --surface-container-highest: #333537;
    --on-surface: #e2e2e5;
    --on-surface-variant: #c4c6cd;
    --outline: #8e9197;
    --outline-variant: #44474d;
    --primary: #fffdff;
    --on-primary: #203148;
    --primary-container: #d0e2ff;
    --on-primary-container: #53647d;
    --secondary: #cac2e2;
    --on-secondary: #312d46;
    --tertiary: #f8fffb;
    --error: #ffb4ab;
    
    /* OLED Optimization */
    --background: #000000;
    
    /* Typography */
    --font-main: 'Inter', sans-serif;
    
    /* Spacing */
    --spacing-unit: 4px;
    --margin-lg: 24px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--background);
    color: var(--on-surface);
    font-family: var(--font-main);
    height: 100vh;
    overflow: hidden;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--surface-container-highest);
    border-radius: 10px;
}

/* Utility Classes */
.glass {
    background: rgba(18, 20, 22, 0.7);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.material-icon-filled {
    font-variation-settings: 'FILL' 1;
}

.pb-safe {
    padding-bottom: max(16px, env(safe-area-inset-bottom));
}

.mb-safe {
    margin-bottom: env(safe-area-inset-bottom);
}

.pill {
    border-radius: 9999px;
}

.card {
    border-radius: 32px;
    background: var(--surface-container-low);
    padding: 20px;
}

/* Animations */
@keyframes slideInUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.animate-msg {
    animation: slideInUp 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

/* Custom Components */
.btn-primary {
    background-color: var(--primary-container);
    color: var(--on-primary-container);
    padding: 12px 24px;
    border-radius: 9999px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Mobile specific adjustments */
@media (max-width: 767px) {
    .chat-list-panel { width: 100% !important; }
    .main-chat-panel { width: 100% !important; position: fixed; inset: 0; z-index: 50; display: none !important; }
    .chat-active .main-chat-panel { display: flex !important; }
    .chat-active .chat-list-panel { display: none !important; }
}

/* Animations */
@keyframes popIn {
    0% { transform: scale(0.85) translateY(15px); opacity: 0; }
    50% { transform: scale(1.02) translateY(-3px); opacity: 1; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

.animate-msg {
    animation: popIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Material 3 Ripple Effect */
.ripple-container {
    position: relative;
    overflow: hidden;
    transform: translate3d(0, 0, 0);
}
.ripple {
    position: absolute;
    border-radius: 50%;
    transform: scale(0);
    animation: ripple-animation 600ms linear;
    background-color: rgba(255, 255, 255, 0.3);
    pointer-events: none;
}
@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Modal Animations */
.modal-enter {
    animation: modal-in 0.3s cubic-bezier(0.2, 0, 0, 1) forwards;
}
.modal-exit {
    animation: modal-out 0.2s cubic-bezier(0.2, 0, 0, 1) forwards;
}
@keyframes modal-in {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes modal-out {
    from { opacity: 1; transform: scale(1) translateY(0); }
    to { opacity: 0; transform: scale(0.95) translateY(10px); }
}

/* Snackbar (Android 12 Toast) */
#snackbar-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.snackbar {
    background-color: #313033; /* Material 3 Inverse Surface */
    color: #F4EFF4; /* Inverse On Surface */
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0px 4px 8px 3px rgba(0,0,0,0.15), 0px 1px 3px rgba(0,0,0,0.3);
    animation: snackbar-in 0.3s cubic-bezier(0.2, 0, 0, 1) forwards;
}
.snackbar.hiding {
    animation: snackbar-out 0.2s cubic-bezier(0.2, 0, 0, 1) forwards;
}
@keyframes snackbar-in {
    from { opacity: 0; transform: translateY(20px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes snackbar-out {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(10px) scale(0.9); }
}

.btn-primary:hover {
    filter: brightness(1.1);
    transform: scale(1.02);
}

.btn-primary:active {
    transform: scale(0.98);
}

.input-container {
    background: var(--surface-container);
    border-radius: 9999px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.input-container:focus-within {
    border-color: var(--primary-container);
}

.message-received {
    background: var(--surface-container);
    border-radius: 24px 24px 24px 4px;
    padding: 12px 16px;
    max-width: 80%;
    align-self: flex-start;
}

.message-sent {
    background: var(--primary-container);
    color: var(--on-primary-container);
    border-radius: 24px 24px 4px 24px;
    padding: 12px 16px;
    max-width: 80%;
    align-self: flex-end;
    box-shadow: 0 4px 20px rgba(211, 228, 255, 0.1);
}
