@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-color: #0f172a;
    --surface-color: rgba(30, 41, 59, 0.7);
    --surface-border: rgba(255, 255, 255, 0.1);
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #10b981;
    --success-hover: #059669;
    --whatsapp: #25D366;
    --whatsapp-hover: #128C7E;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --danger: #ef4444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

body {
    background: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-image: radial-gradient(circle at top right, rgba(59, 130, 246, 0.15), transparent 400px),
                      radial-gradient(circle at bottom left, rgba(16, 185, 129, 0.1), transparent 400px);
    background-attachment: fixed;
}

/* Glassmorphism Utilities */
.glass-panel {
    background: var(--surface-color);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--surface-border);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

/* Auth Container */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    padding: 20px;
}

.auth-box {
    width: 100%;
    max-width: 400px;
    padding: 40px;
    text-align: center;
    animation: fadeIn 0.5s ease-out;
}

.auth-box h2 {
    margin-bottom: 8px;
    font-weight: 600;
}

.auth-box p {
    color: var(--text-muted);
    margin-bottom: 24px;
    font-size: 0.9rem;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 1rem;
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: var(--success-hover);
}

.btn-whatsapp {
    background: var(--whatsapp);
    color: white;
    text-decoration: none;
}

.btn-whatsapp:hover {
    background: var(--whatsapp-hover);
    transform: translateY(-1px);
}

/* Dashboard */
.header {
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--surface-border);
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-title {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.user-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logout-btn {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--surface-border);
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.2s;
}

.logout-btn:hover {
    color: var(--danger);
    border-color: var(--danger);
}

/* Main Layout */
.container {
    padding: 40px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.page-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.add-lead-btn {
    width: auto;
}

/* Leads Grid */
.leads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.lead-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.lead-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.2);
}

.lead-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.lead-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-main);
}

.lead-product {
    font-size: 0.85rem;
    padding: 4px 10px;
    background: rgba(59, 130, 246, 0.1);
    color: #60a5fa;
    border-radius: 20px;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.lead-contact {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.lead-contact span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lead-response {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--surface-border);
}

.lead-response p {
    font-size: 0.9rem;
    color: #e2e8f0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.response-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: #1e293b;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    border-radius: 16px;
    border: 1px solid var(--surface-border);
    display: flex;
    flex-direction: column;
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--surface-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.close-modal {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover {
    color: var(--text-main);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
}

/* Detail View Layout inside Modal */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.info-block {
    background: rgba(15, 23, 42, 0.4);
    padding: 16px;
    border-radius: 8px;
    border: 1px solid var(--surface-border);
}

.info-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.info-value {
    font-size: 1rem;
    color: var(--text-main);
    font-weight: 500;
}

.whatsapp-action {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
}

/* Remarks Timeline */
.remarks-section {
    margin-top: 32px;
    border-top: 1px solid var(--surface-border);
    padding-top: 24px;
}

.remarks-section h3 {
    margin-bottom: 16px;
    font-size: 1.1rem;
}

.add-remark-box {
    margin-bottom: 24px;
    display: flex;
    gap: 12px;
}

.add-remark-box textarea {
    flex: 1;
    min-height: 44px;
    height: 44px;
}

.add-remark-box button {
    width: auto;
    padding: 0 20px;
}

.timeline {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    padding-left: 20px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--surface-border);
}

.remark-item {
    position: relative;
    background: rgba(15, 23, 42, 0.4);
    padding: 16px;
    border-radius: 8px;
    border: 1px solid var(--surface-border);
}

.remark-item::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 20px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 0 4px #1e293b;
}

.remark-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.remark-text {
    font-size: 0.95rem;
    line-height: 1.5;
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    display: none;
}

.alert.error {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.2);
    display: block;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
