/* Custom CSS for CRM Data Management System */

:root {
    --primary-color: #4e73df;
    --secondary-color: #858796;
    --success-color: #1cc88a;
    --info-color: #36b9cc;
    --warning-color: #f6c23e;
    --danger-color: #e74a3b;
    --dark-color: #5a5c69;
    --light-color: #f8f9fc;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-color);
    color: #333;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

.login-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: pulse 15s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.login-card {
    border-radius: 20px;
    overflow: hidden;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.login-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 36px;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.card {
    border-radius: 15px;
    overflow: hidden;
    border: none;
}

.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 10px 20px;
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Sidebar Styles */
.sidebar {
    min-height: 100vh;
    background: linear-gradient(180deg, var(--primary-color) 0%, #224abe 100%);
    box-shadow: 2px 0 15px rgba(0,0,0,0.15);
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    width: 250px !important;
    max-width: 250px !important;
    /* Keep below Bootstrap modals (1050/1040) */
    z-index: 1030 !important;
    display: flex !important;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100vh;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 1020;
    display: none;
}

body.sidebar-open .sidebar-backdrop {
    display: block;
}

.sidebar .brand {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 10px;
}

.sidebar .brand h5 {
    color: #fff;
    font-weight: 700;
    margin: 0;
    font-size: 20px;
    display: flex;
    align-items: center;
}

.sidebar .brand p {
    color: rgba(255,255,255,0.7);
    font-size: 13px;
    margin: 5px 0 0 0;
}

.sidebar .nav-link i {
    width: 22px;
    text-align: center;
    margin-right: 12px;
    font-size: 16px;
}

.sidebar .nav {
    padding: 10px 15px;
}

.sidebar .nav-link {
    color: rgba(255,255,255,0.8);
    padding: 12px 20px;
    margin: 3px 0;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-size: 15px;
    display: flex;
    align-items: center;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    background-color: rgba(255,255,255,0.1);
    color: #fff;
}

.sidebar .nav-link i {
    width: 25px;
    margin-right: 10px;
}

/* Header Styles */
.header {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 20px 30px;
    margin-bottom: 30px;
    border-radius: 12px;
    position: relative;
    z-index: 10;
}

.app-frame {
    display: flex;
    min-height: 100vh;
}

.main-content {
    background-color: #f5f7fa;
    min-height: 100vh;
    padding: 20px 30px;
    margin-left: 250px !important;
    transition: margin-left 0.3s ease;
    width: calc(100% - 250px) !important;
    max-width: calc(100% - 250px);
    box-sizing: border-box;
    float: none;
    clear: both;
    position: relative;
    z-index: 1 !important;
}

.header h4 {
    color: var(--dark-color);
    margin: 0;
}

/* Dashboard Cards */
.stat-card {
    border-radius: 12px;
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    margin-bottom: 20px;
    background: #fff;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.stat-card .card-body {
    padding: 25px;
}

.stat-card .stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 15px;
}

.stat-card.primary .stat-icon {
    background-color: rgba(78, 115, 223, 0.2);
    color: var(--primary-color);
}

.stat-card.success .stat-icon {
    background-color: rgba(28, 200, 138, 0.2);
    color: var(--success-color);
}

.stat-card.warning .stat-icon {
    background-color: rgba(246, 194, 62, 0.2);
    color: var(--warning-color);
}

.stat-card.info .stat-icon {
    background-color: rgba(54, 185, 204, 0.2);
    color: var(--info-color);
}

.stat-card h3 {
    font-size: 32px;
    font-weight: 700;
    margin: 10px 0;
    color: var(--dark-color);
}

.stat-card p {
    color: #6c757d;
    font-size: 14px;
    margin: 0;
}

/* Table Styles */
.table-container {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 25px;
    margin-bottom: 20px;
    border: 1px solid #e3e6f0;
}

.table {
    margin-bottom: 0;
}

.table thead {
    background-color: var(--light-color);
}

.table thead th {
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    color: var(--dark-color);
    padding: 15px;
}

.table tbody td {
    padding: 15px;
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background-color: rgba(78, 115, 223, 0.05);
}

/* Form Styles */
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #d1d3e2;
    padding: 10px 15px;
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25);
    outline: none;
}

.input-group-lg .form-control {
    padding: 12px 15px;
    font-size: 16px;
}

.input-group-text {
    border-radius: 8px 0 0 8px;
}

/* Badge Styles */
.badge {
    padding: 8px 12px;
    border-radius: 6px;
    font-weight: 500;
}

/* Search Box */
.search-box {
    position: relative;
    margin-bottom: 20px;
}

.search-box input {
    padding-left: 45px;
}

.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary-color);
}

/* Comment Box */
.comment-section {
    background: #f8f9fc;
    border-radius: 8px;
    padding: 15px;
    margin-top: 10px;
}

.comment-item {
    background: #fff;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 10px;
    border-left: 3px solid var(--primary-color);
}

.comment-item .comment-author {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 14px;
}

.comment-item .comment-date {
    font-size: 12px;
    color: var(--secondary-color);
}

/* Checkbox Custom */
.form-check-input:checked {
    background-color: var(--success-color);
    border-color: var(--success-color);
}

/* Alert Styles */
.alert {
    border-radius: 8px;
    border: none;
}

/* Modal Styles */
.modal-content {
    border-radius: 12px;
    border: none;
}

.modal-header {
    border-bottom: 1px solid #e3e6f0;
    padding: 20px;
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    border-top: 1px solid #e3e6f0;
    padding: 20px;
}

/* Loading Spinner */
.spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Button Enhancements */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #224abe 100%);
    border: none;
    font-weight: 600;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #224abe 0%, var(--primary-color) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(78, 115, 223, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #17a673 100%);
    border: none;
}

.btn-success:hover {
    background: linear-gradient(135deg, #17a673 0%, var(--success-color) 100%);
}

/* Page Title */
.page-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 10px;
}

.page-subtitle {
    color: #6c757d;
    font-size: 14px;
}

/* Responsive */
@media (max-width: 991.98px) {
    .app-frame {
        flex-direction: column;
    }

    .sidebar {
        transform: translateX(-102%);
        width: 240px !important;
        max-width: 80% !important;
        box-shadow: 4px 0 15px rgba(0,0,0,0.2);
    }

    .sidebar.show,
    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    body.sidebar-open {
        overflow: hidden;
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 18px 16px;
    }

    .header {
        position: sticky;
        top: 0;
        z-index: 50;
    }

    .stat-card h3 {
        font-size: 24px;
    }
    
    .table-container {
        padding: 10px;
        overflow-x: auto;
    }
    
    .login-card {
        margin: 20px;
    }
}

@media (max-width: 575.98px) {
    .header {
        padding: 16px 18px;
    }

    .page-title {
        font-size: 22px;
    }

    .stat-card .card-body {
        padding: 18px;
    }

    .stat-card h3 {
        font-size: 20px;
    }
}

/* Action Buttons */
.action-btns {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.action-btns .btn {
    padding: 5px 12px;
    font-size: 14px;
}

/* Data Table Actions */
.data-actions {
    white-space: nowrap;
}

/* Permission Badge */
.permission-badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
}

.permission-yes {
    background-color: rgba(28, 200, 138, 0.2);
    color: var(--success-color);
}

.permission-no {
    background-color: rgba(231, 74, 59, 0.2);
    color: var(--danger-color);
}

