/* StoneOak CRM - Custom Styles */

/* Navigation Links */
.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: 0.625rem;
    color: #a8a29e; /* stone-400 */
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s ease;
    text-decoration: none;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.nav-link.active {
    background-color: rgba(20, 184, 166, 0.15);
    color: #5eead4; /* teal-300 */
}

.nav-link.active svg {
    color: #14b8a6; /* teal-500 */
}

/* Card Components */
.card {
    background: white;
    border-radius: 1rem;
    border: 1px solid #e7e5e4; /* stone-200 */
    padding: 1.5rem;
}

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

/* Stage Badges */
.stage-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.stage-new_lead        { background: #dbeafe; color: #1d4ed8; }
.stage-interested      { background: #e0e7ff; color: #4338ca; }
.stage-rnr             { background: #fef3c7; color: #b45309; }
.stage-follow_up       { background: #ffedd5; color: #c2410c; }
.stage-site_visit_scheduled { background: #f3e8ff; color: #7c3aed; }
.stage-site_visit_completed { background: #ccfbf1; color: #0f766e; }
.stage-prospect        { background: #cffafe; color: #0891b2; }
.stage-booked          { background: #dcfce7; color: #15803d; }
.stage-lost            { background: #fee2e2; color: #b91c1c; }

/* Source Badges */
.source-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.6875rem;
    font-weight: 500;
}

.source-meta     { background: #dbeafe; color: #1d4ed8; }
.source-walkin   { background: #dcfce7; color: #15803d; }
.source-google   { background: #fef3c7; color: #b45309; }
.source-whatsapp { background: #d1fae5; color: #047857; }
.source-referral { background: #f3e8ff; color: #7c3aed; }

/* Role Badges */
.role-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
}

.role-admin                { background: #fee2e2; color: #b91c1c; }
.role-sales_manager        { background: #dbeafe; color: #1d4ed8; }
.role-relationship_manager { background: #dcfce7; color: #15803d; }

/* Table Styles */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table thead th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #78716c; /* stone-500 */
    border-bottom: 2px solid #e7e5e4;
    white-space: nowrap;
}

.data-table tbody td {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: #44403c; /* stone-700 */
    border-bottom: 1px solid #f5f5f4; /* stone-100 */
}

.data-table tbody tr:hover {
    background-color: #fafaf9; /* stone-50 */
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1rem;
}

.modal-content {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 32rem;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

/* Toast Notifications */
.toast {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 200;
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    transform: translateX(120%);
    transition: transform 0.3s ease;
}

.toast.show {
    transform: translateX(0);
}

.toast-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.toast-error   { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.toast-info    { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* Timeline */
.timeline-item {
    position: relative;
    padding-left: 2rem;
    padding-bottom: 1.5rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: 0.4375rem;
    top: 1.5rem;
    bottom: 0;
    width: 2px;
    background: #e7e5e4;
}

.timeline-item:last-child::before {
    display: none;
}

.timeline-dot {
    position: absolute;
    left: 0;
    top: 0.25rem;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    border: 2px solid;
    background: white;
}

/* Form Styles */
.form-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid #d6d3d1;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    color: #292524;
    transition: all 0.15s ease;
}

.form-input:focus {
    outline: none;
    border-color: #14b8a6;
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.1);
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #44403c;
    margin-bottom: 0.375rem;
}

.form-error {
    font-size: 0.75rem;
    color: #b91c1c;
    margin-top: 0.25rem;
}

/* Button Variants */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.15s ease;
    cursor: pointer;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: #0d9488;
    color: white;
    box-shadow: 0 4px 14px -3px rgba(13, 148, 136, 0.3);
}
.btn-primary:hover { background: #0f766e; }

.btn-secondary {
    background: #f5f5f4;
    color: #44403c;
    border: 1px solid #d6d3d1;
}
.btn-secondary:hover { background: #e7e5e4; }

.btn-danger {
    background: #dc2626;
    color: white;
}
.btn-danger:hover { background: #b91c1c; }

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 0.5rem;
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: currentColor;
    animation: spin 0.6s linear infinite;
}

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

/* KPI Cards */
.kpi-card {
    background: white;
    border-radius: 1rem;
    border: 1px solid #e7e5e4;
    padding: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.kpi-icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    shrink: 0;
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

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

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

/* Responsive Table Container */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Auto-dismiss flash messages */
.flash-message {
    animation: fadeOut 0.5s ease 5s forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(-10px);
        height: 0;
        padding: 0;
        margin: 0;
        border: 0;
        overflow: hidden;
    }
}
