/* Minimal CRM Design */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #ffffff;
    color: #1a1a1a;
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Authentication */
.auth-section {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #f8f9fa;
}

.auth-container {
    background: white;
    padding: 3rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 400px;
    width: 100%;
}

.auth-container h1 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #1a1a1a;
}

.auth-container p {
    color: #666;
    margin-bottom: 2rem;
}

/* CRM App */
.crm-app {
    min-height: 100vh;
}

/* Header */
.header {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 1rem 0;
    margin-bottom: 2rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1a1a1a;
}

.sync-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #666;
}

.sync-status.syncing {
    color: #f59e0b;
}

.sync-status.error {
    color: #ef4444;
}

.sync-status i {
    animation: spin 1s linear infinite;
}

.sync-status.syncing i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.nav {
    display: flex;
    gap: 0.5rem;
}

.nav-btn {
    background: none;
    border: none;
    color: #666;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.nav-btn:hover {
    background: #f3f4f6;
    color: #1a1a1a;
}

.nav-btn.active {
    background: #1a1a1a;
    color: white;
}

/* Main Content */
.main-content {
    min-height: 70vh;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

/* Dashboard */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.2s ease;
}

.stat-card:hover {
    border-color: #d1d5db;
}

.stat-number {
    font-size: 2rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.recent-section {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.recent-section h2,
.sheets-section h2,
.view-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #1a1a1a;
}

.activity-list {
    max-height: 300px;
    overflow-y: auto;
}

.no-activity {
    text-align: center;
    color: #999;
    padding: 2rem;
    font-size: 0.875rem;
}

.activity-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-time {
    font-size: 0.75rem;
    color: #999;
}

/* Sheets Section */
.sheets-section {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.5rem;
}

.sheets-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.sheets-info {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
}

.sheets-info p {
    margin-bottom: 0.5rem;
    color: #666;
}

.sheets-info p:last-child {
    margin-bottom: 0;
}

/* Contacts */
.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.contacts-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.search-input,
.filter-select,
.spreadsheet-input {
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: border-color 0.2s ease;
}

.search-input:focus,
.filter-select:focus,
.spreadsheet-input:focus {
    outline: none;
    border-color: #1a1a1a;
}

.search-input {
    flex: 1;
    min-width: 200px;
}

.contacts-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.contact-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.2s ease;
}

.contact-card:hover {
    border-color: #d1d5db;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.contact-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.contact-name {
    font-weight: 600;
    color: #1a1a1a;
}

.contact-stage {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.stage-lead { background: #dbeafe; color: #1e40af; }
.stage-prospect { background: #fef3c7; color: #92400e; }
.stage-qualified { background: #d1fae5; color: #065f46; }
.stage-customer { background: #e0e7ff; color: #3730a3; }

.contact-info {
    margin-bottom: 0.75rem;
}

.contact-info p {
    margin-bottom: 0.25rem;
    color: #666;
    font-size: 0.875rem;
}

.contact-actions {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

/* Kanban */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 1rem;
}

.kanban-column {
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.column-header {
    padding: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.column-header h3 {
    font-size: 0.75rem;
    font-weight: 600;
    color: #1a1a1a;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.column-count {
    background: #e5e7eb;
    color: #666;
    padding: 0.125rem 0.375rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 500;
}

.column-items {
    flex: 1;
    padding: 0.5rem;
    overflow-y: auto;
}

.kanban-item {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    cursor: move;
    transition: all 0.2s ease;
}

.kanban-item:hover {
    border-color: #d1d5db;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.kanban-item.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.kanban-item-title {
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: #1a1a1a;
    font-size: 0.875rem;
}

.kanban-item-contact {
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 0.25rem;
}

.kanban-item-value {
    font-size: 0.75rem;
    color: #059669;
    font-weight: 500;
}

/* Follow-ups */
.followups-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.followup-item {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.followup-content {
    flex: 1;
    min-width: 200px;
}

.followup-title {
    font-weight: 500;
    color: #1a1a1a;
    margin-bottom: 0.25rem;
}

.followup-contact {
    color: #666;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.followup-due {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: #666;
    font-size: 0.75rem;
}

.followup-priority {
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.priority-low { background: #dbeafe; color: #1e40af; }
.priority-medium { background: #fef3c7; color: #92400e; }
.priority-high { background: #fecaca; color: #991b1b; }

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: 1px solid #1a1a1a;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background: white;
    color: #1a1a1a;
}

.btn:hover {
    background: #1a1a1a;
    color: white;
}

.btn-secondary {
    border-color: #d1d5db;
    color: #666;
}

.btn-secondary:hover {
    background: #f3f4f6;
    color: #1a1a1a;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.2s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.2s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1a1a1a;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: #666;
    padding: 0.25rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.close-btn:hover {
    background-color: #f3f4f6;
    color: #1a1a1a;
}

.setup-content {
    padding: 1rem;
}

.setup-steps h4 {
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 0.5rem;
}

.setup-steps ol {
    margin-bottom: 1rem;
    padding-left: 1.25rem;
}

.setup-steps li {
    margin-bottom: 0.5rem;
    color: #374151;
    font-size: 0.875rem;
}

.setup-steps ul {
    margin-top: 0.25rem;
    padding-left: 1.25rem;
}

.setup-steps ul li {
    margin-bottom: 0.25rem;
}

.setup-steps a {
    color: #1a1a1a;
    text-decoration: none;
}

.setup-steps a:hover {
    text-decoration: underline;
}

/* Forms */
#contact-form,
#followup-form,
#call-form {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

#contact-form input,
#contact-form select,
#followup-form input,
#followup-form select,
#followup-form textarea,
#call-form input,
#call-form select,
#call-form textarea {
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: border-color 0.2s ease;
}

#contact-form input:focus,
#contact-form select:focus,
#followup-form input:focus,
#followup-form select:focus,
#followup-form textarea:focus,
#call-form input:focus,
#call-form select:focus,
#call-form textarea:focus {
    outline: none;
    border-color: #1a1a1a;
}

#call-form p {
    font-weight: 500;
    color: #1a1a1a;
    margin-bottom: 0.5rem;
}

#call-form label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #374151;
}

.modal-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    padding: 1rem;
    border-top: 1px solid #e5e7eb;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    .header h1 {
        font-size: 1.25rem;
    }

    .nav {
        gap: 0.25rem;
        overflow-x: auto;
    }

    .nav-btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.75rem;
        white-space: nowrap;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-number {
        font-size: 1.5rem;
    }

    .kanban-board {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .view-header,
    .sheets-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .contacts-controls {
        flex-direction: column;
    }

    .search-input {
        min-width: 100%;
    }

    .followup-item {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .contact-actions {
        justify-content: center;
    }

    .modal-content {
        width: 95%;
        margin: 1rem;
    }

    .modal-actions {
        flex-direction: column;
    }

    .sheets-controls {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .kanban-board {
        grid-template-columns: 1fr;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Loading Spinner */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #1a1a1a;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Error Message */
.error-message {
    background: #fef2f2;
    color: #991b1b;
    padding: 0.75rem;
    border-radius: 6px;
    border-left: 4px solid #ef4444;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.success-message {
    background: #f0fdf4;
    color: #166534;
    padding: 0.75rem;
    border-radius: 6px;
    border-left: 4px solid #10b981;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}