/* Sakura CRM Custom Styles - Modern Design */

/* Root Variables */
:root {
    --sakura-primary: #d32f5f;
    --sakura-secondary: #f27a93;
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

/* Sidebar Layout Fixes */
.sidebar-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: white;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
}

.main-content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.top-header {
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    flex-shrink: 0;
}

.page-content {
    flex: 1;
    overflow-y: auto;
    background: #fafafa;
    padding: 1.5rem;
}

/* Global Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #fafafa;
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.5;
}

/* Smooth transitions */
* {
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Custom scrollbar - Minimal */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Modern Card Styles */
.modern-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
}

.modern-card-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.modern-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.modern-card-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Card hover effects */
.card-hover {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
}

.card-hover:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    border-color: #d1d5db;
}

/* Stat Cards */
.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), transparent);
    border-radius: 50%;
    transform: translate(30%, -30%);
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
    margin: 0.5rem 0;
}

.stat-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-change {
    font-size: 12px;
    font-weight: 500;
    margin-top: 0.25rem;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

/* Button loading state */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spinner 0.6s linear infinite;
}

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

/* Modern Buttons */
.btn-modern {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-modern:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-modern:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--sakura-primary);
    color: white;
    border-color: var(--sakura-primary);
}

.btn-primary:hover {
    background: #b31e4a;
    border-color: #b31e4a;
}

.btn-secondary {
    background: white;
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

/* Stage badges - Modern minimal style */
.stage-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    border: 1px solid;
}

.stage-new-lead {
    background-color: #eff6ff;
    color: #1e40af;
    border-color: #bfdbfe;
}

.stage-contacted {
    background-color: #f5f3ff;
    color: #6b21a8;
    border-color: #ddd6fe;
}

.stage-trial-booked {
    background-color: #fff7ed;
    color: #c2410c;
    border-color: #fed7aa;
}

.stage-trial-done {
    background-color: #f0fdf4;
    color: #15803d;
    border-color: #bbf7d0;
}

.stage-offer-sent {
    background-color: #fdf2f8;
    color: #be185d;
    border-color: #fbcfe8;
}

.stage-negotiation {
    background-color: #fefce8;
    color: #a16207;
    border-color: #fef08a;
}

.stage-closed-won {
    background-color: #dcfce7;
    color: #166534;
    border-color: #86efac;
}

.stage-closed-lost {
    background-color: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}

/* Priority badges */
.priority-low {
    background-color: #e3f2fd;
    color: #1976d2;
}

.priority-medium {
    background-color: #fff3e0;
    color: #f57c00;
}

.priority-high {
    background-color: #ffebee;
    color: #d32f2f;
}

.priority-urgent {
    background-color: #b71c1c;
    color: #ffffff;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

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

.table-striped tbody tr:nth-child(odd) {
    background-color: #f9fafb;
}

.table-hover tbody tr:hover {
    background-color: #fef2f4;
}

/* Form styles */
.form-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: #d32f5f;
    box-shadow: 0 0 0 3px rgba(211, 47, 95, 0.1);
}

.form-input.error {
    border-color: #dc2626;
}

.form-input.error:focus {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* Modal overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: white;
    border-radius: 0.5rem;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

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

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

/* Drag and drop styles */
.draggable {
    cursor: move;
    user-select: none;
}

.dragging {
    opacity: 0.5;
}

.drop-zone {
    min-height: 100px;
    border: 2px dashed #d1d5db;
    border-radius: 0.5rem;
    transition: border-color 0.2s, background-color 0.2s;
}

.drop-zone.drag-over {
    border-color: #d32f5f;
    background-color: #fef2f4;
}

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

.timeline::before {
    content: "";
    position: absolute;
    left: 0.5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, #d32f5f, #f7a8b8);
}

.timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
}

.timeline-item::before {
    content: "";
    position: absolute;
    left: -1.375rem;
    top: 0.25rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #d32f5f;
    border: 2px solid white;
    box-shadow: 0 0 0 2px #d32f5f;
}

/* Stats card */
.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent);
    border-radius: 50%;
    transform: translate(30%, -30%);
}

/* Chart container */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.empty-state-icon {
    font-size: 4rem;
    color: #d1d5db;
    margin-bottom: 1rem;
}

/* Loading skeleton */
.skeleton {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Tooltip */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltip-text {
    visibility: hidden;
    background-color: #1f2937;
    color: white;
    text-align: center;
    padding: 0.5rem;
    border-radius: 0.375rem;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.75rem;
    white-space: nowrap;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white;
    }
    
    .card-hover {
        box-shadow: none !important;
    }
}

/* Responsive utilities */
@media (max-width: 640px) {
    .mobile-stack {
        flex-direction: column;
    }
    
    .mobile-full {
        width: 100%;
    }
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus styles for keyboard navigation */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #d32f5f;
    outline-offset: 2px;
}

/* Gradient backgrounds */
.gradient-sakura {
    background: linear-gradient(135deg, #d32f5f 0%, #f27a93 100%);
}

.gradient-success {
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
}

.gradient-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
}

.gradient-danger {
    background: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
}

/* Text gradient */
.text-gradient-sakura {
    background: linear-gradient(135deg, #d32f5f 0%, #f27a93 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
