/**
 * Capitalis Trading Solutions CRM
 * Main Stylesheet
 */

/* ============================================
   RESET & BASE STYLES
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Colors */
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #06b6d4;
    
    /* Grays */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    
    /* Sidebar */
    --sidebar-width: 260px;
    --sidebar-bg: var(--gray-900);
    --sidebar-text: var(--gray-300);
    --sidebar-active: var(--primary-color);
    
    /* Layout */
    --header-height: 70px;
    --border-radius: 8px;
    --transition: all 0.3s ease;
    
    /* Shadows */
    --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);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--gray-800);
    background-color: var(--gray-50);
}

a {
    text-decoration: none;
    color: inherit;
}

/* ============================================
   CRM CONTAINER & LAYOUT
   ============================================ */

.crm-container {
    display: flex;
    min-height: 100vh;
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h1 {
    font-size: 20px;
    font-weight: 700;
    color: white;
    margin-bottom: 4px;
}

.company-subtitle {
    font-size: 12px;
    color: var(--gray-400);
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--sidebar-text);
    transition: var(--transition);
    cursor: pointer;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: white;
}

.nav-item.active {
    background-color: rgba(37, 99, 235, 0.1);
    border-left-color: var(--primary-color);
    color: white;
}

.nav-item i {
    width: 20px;
    margin-right: 12px;
    font-size: 16px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.user-details {
    flex: 1;
}

.user-name {
    font-weight: 600;
    color: white;
    font-size: 14px;
}

.user-role {
    font-size: 12px;
    color: var(--gray-400);
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    border-radius: var(--border-radius);
    transition: var(--transition);
    font-size: 13px;
}

.logout-btn:hover {
    background-color: rgba(239, 68, 68, 0.2);
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    background-color: var(--gray-50);
}

.content-header {
    height: var(--header-height);
    background-color: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.content-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
    text-transform: capitalize;
}

.current-date {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--gray-600);
    font-size: 14px;
}

.content-body {
    padding: 30px;
}

/* ============================================
   ALERTS
   ============================================ */

.alert {
    padding: 14px 18px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideDown 0.3s ease;
}

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

.alert i {
    font-size: 18px;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border-left: 4px solid var(--success-color);
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border-left: 4px solid var(--danger-color);
}

.alert-warning {
    background-color: #fef3c7;
    color: #92400e;
    border-left: 4px solid var(--warning-color);
}

.alert-info {
    background-color: #cffafe;
    color: #155e75;
    border-left: 4px solid var(--info-color);
}

/* ============================================
   CARDS
   ============================================ */

.card {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    margin-bottom: 24px;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-body {
    padding: 24px;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background-color: #1d4ed8;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background-color: #059669;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background-color: #dc2626;
}

.btn-outline {
    background-color: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.btn-outline:hover {
    background-color: var(--primary-color);
    color: white;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-block {
    width: 100%;
}

/* ============================================
   BADGES
   ============================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-primary {
    background-color: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

.badge-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.badge-warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.badge-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.badge-info {
    background-color: rgba(6, 182, 212, 0.1);
    color: var(--info-color);
}

.badge-secondary {
    background-color: var(--gray-100);
    color: var(--gray-600);
}

/* ============================================
   FORMS
   ============================================ */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--gray-700);
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

select.form-control {
    cursor: pointer;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* ============================================
   DASHBOARD SPECIFIC
   ============================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background-color: white;
    padding: 24px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.stat-primary .stat-icon {
    background-color: var(--primary-color);
}

.stat-success .stat-icon {
    background-color: var(--success-color);
}

.stat-warning .stat-icon {
    background-color: var(--warning-color);
}

.stat-info .stat-icon {
    background-color: var(--info-color);
}

.stat-details h3 {
    font-size: 32px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.stat-details p {
    color: var(--gray-600);
    font-size: 14px;
}

.dashboard-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-bottom: 24px;
}

.dashboard-col-6 {
    min-width: 0;
}

/* Deal Type Stats */
.deal-type-stats {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.deal-type-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.deal-type-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.deal-type-count {
    font-size: 13px;
    color: var(--gray-600);
}

.deal-type-bar {
    height: 8px;
    background-color: var(--gray-100);
    border-radius: 4px;
    overflow: hidden;
}

.deal-type-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.deal-type-buy {
    background-color: var(--primary-color);
}

.deal-type-sell {
    background-color: var(--success-color);
}

.deal-type-lease {
    background-color: var(--info-color);
}

/* Status Overview */
.status-overview {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background-color: var(--gray-50);
    border-radius: var(--border-radius);
}

.status-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.status-name {
    font-weight: 500;
    color: var(--gray-900);
}

.status-percentage {
    font-size: 12px;
    color: var(--gray-600);
}

.status-count {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
}

/* Deal List */
.deal-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.deal-item {
    padding: 16px;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    transition: var(--transition);
    display: block;
}

.deal-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.deal-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.deal-code {
    font-weight: 600;
    color: var(--gray-900);
    font-size: 13px;
}

.deal-item-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}

.deal-product,
.deal-party {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--gray-600);
}

.deal-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.deal-date {
    font-size: 12px;
    color: var(--gray-500);
}

/* Activity List */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.activity-item {
    display: flex;
    gap: 12px;
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-auth {
    background-color: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

.activity-deal {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.activity-user {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.activity-document {
    background-color: rgba(6, 182, 212, 0.1);
    color: var(--info-color);
}

.activity-details {
    flex: 1;
}

.activity-action {
    font-weight: 500;
    color: var(--gray-900);
    margin-bottom: 4px;
    font-size: 13px;
}

.activity-meta {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--gray-500);
}

.activity-meta i {
    font-size: 11px;
}

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 24px;
    background-color: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius);
    transition: var(--transition);
    cursor: pointer;
}

.quick-action-btn:hover {
    border-color: var(--primary-color);
    background-color: rgba(37, 99, 235, 0.05);
}

.quick-action-btn i {
    font-size: 28px;
    color: var(--primary-color);
}

.quick-action-btn span {
    font-weight: 500;
    color: var(--gray-700);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
}

.empty-state i {
    font-size: 48px;
    color: var(--gray-300);
    margin-bottom: 16px;
}

.empty-state p {
    color: var(--gray-500);
    margin-bottom: 20px;
}

/* ============================================
   LOGIN PAGE
   ============================================ */

.login-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    max-width: 1000px;
    width: 90%;
    background-color: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-box {
    padding: 50px;
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.login-header .logo {
    width: 80px;
    height: 80px;
    background-color: var(--primary-color);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.login-header .logo i {
    font-size: 36px;
    color: white;
}

.login-header h1 {
    font-size: 24px;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.login-header p {
    color: var(--gray-600);
}

.login-form {
    margin-bottom: 30px;
}

.login-footer {
    text-align: center;
    font-size: 12px;
    color: var(--gray-500);
}

.version {
    margin-top: 8px;
    color: var(--gray-400);
}

.login-info {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 50px;
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-info h2 {
    font-size: 28px;
    margin-bottom: 20px;
}

.login-info p {
    margin-bottom: 30px;
    font-size: 16px;
    opacity: 0.9;
}

.login-info ul {
    list-style: none;
}

.login-info li {
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
}

.login-info li i {
    color: #4ade80;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .sidebar {
        width: 70px;
    }
    
    .sidebar-header h1,
    .company-subtitle,
    .nav-item span,
    .user-details,
    .logout-btn {
        display: none;
    }
    
    .nav-item {
        justify-content: center;
    }
    
    .main-content {
        margin-left: 70px;
    }
    
    .dashboard-row {
        grid-template-columns: 1fr;
    }
    
    .login-container {
        grid-template-columns: 1fr;
    }
    
    .login-info {
        display: none;
    }
}
