/* ===== GLOBAL STYLES ===== */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --body-bg: #1a252f;
    --card-bg: #ffffff;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --border-color: #dee2e6;
    --shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --transition: all 0.3s ease;
}

* {
    box-sizing: border-box;
}

html, body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a252f 0%, #2c3e50 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

/* ===== HEADER STYLES ===== */
h1 {
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

/* ===== CARD STYLES ===== */
.card {
    border: none;
    border-radius: 15px;
    box-shadow: var(--shadow);
    background: var(--card-bg);
    overflow: hidden;
}

.card-body {
    padding: 0;
}

/* ===== CONTACT LIST STYLES ===== */
.contact-list-container {
    border-radius: 10px;
    background: var(--light-color);
    border: 1px solid var(--border-color);
}

.contact-list-item {
    border: none;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
    cursor: pointer;
    padding: 15px;
}

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

.contact-list-item:hover {
    background-color: var(--light-color);
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.contact-list-item .contact-avatar {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--info-color));
    border-radius: 50%;
    color: white;
}

.contact-list-item .contact-info {
    flex: 1;
    margin-left: 15px;
}

.contact-list-item .contact-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.contact-list-item .contact-number {
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.contact-list-item .contact-actions {
    opacity: 0;
    transition: var(--transition);
}

.contact-list-item:hover .contact-actions {
    opacity: 1;
}

.contact-list-item .btn {
    padding: 5px 10px;
    font-size: 0.8em;
    border-radius: 20px;
}

/* ===== SEARCH STYLES ===== */
.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-wrapper .form-control {
    padding-left: 2.5rem;
    padding-right: 2.5rem;
}

.search-wrapper .search-icon {
    position: absolute;
    left: 1rem;
    color: #6c757d;
    z-index: 5;
}

.search-wrapper .search-clear-btn {
    position: absolute;
    right: 1rem;
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    z-index: 5;
}

.search-wrapper .search-clear-btn:hover {
    background-color: #e9ecef;
    color: #495057;
}

.search-results-container {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 5px;
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

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

.search-result-item:hover {
    background-color: var(--light-color);
}

.search-result-item.active {
    background-color: var(--primary-color);
    color: white;
}

.search-result-item .contact-avatar {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--light-color);
    border-radius: 50%;
    margin-right: 15px;
    color: var(--text-secondary);
}

.search-result-item .contact-info {
    flex: 1;
}

.search-result-item .contact-name {
    font-weight: 600;
    margin-bottom: 5px;
}

.search-result-item .contact-number {
    font-size: 0.9em;
    color: var(--text-secondary);
}

.search-result-item .contact-actions {
    display: flex;
    gap: 5px;
}

.search-result-item .btn {
    padding: 5px 8px;
    font-size: 0.8em;
}

/* ===== NO RESULTS STYLES ===== */
.no-results {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-secondary);
}

.no-results i {
    font-size: 3em;
    margin-bottom: 15px;
    color: var(--text-secondary);
}

.no-results p {
    font-size: 1.1em;
    margin-bottom: 10px;
}

.no-results small {
    font-size: 0.9em;
}

/* ===== MODAL STYLES ===== */
.modal-content {
    border: none;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
    border-radius: 15px 15px 0 0;
    border-bottom: none;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 20px;
}

/* ===== FORM STYLES ===== */
.form-control {
    border-radius: 10px;
    border: 2px solid var(--border-color);
    padding: 12px 15px;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.form-control.is-valid {
    border-color: var(--success-color);
}

.form-control.is-invalid {
    border-color: var(--danger-color);
}

.form-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-text {
    color: var(--text-secondary);
    font-size: 0.9em;
}

/* ===== BUTTON STYLES ===== */
.btn {
    border-radius: 10px;
    font-weight: 600;
    padding: 10px 20px;
    transition: var(--transition);
    border: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color), #c82333);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color), #146c43);
}

.btn-info {
    background: linear-gradient(135deg, var(--info-color), #0aa2c0);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-color), #e0a800);
}

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

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

.btn-outline-danger {
    border: 2px solid var(--danger-color);
    color: var(--danger-color);
}

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

.btn-outline-info {
    border: 2px solid var(--info-color);
    color: var(--info-color);
}

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

.btn-outline-warning {
    border: 2px solid var(--warning-color);
    color: var(--warning-color);
}

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

/* ===== BADGE STYLES ===== */
.badge {
    font-size: 0.9em;
    padding: 8px 12px;
    border-radius: 20px;
}

/* ===== STATISTICS STYLES ===== */
.bg-light {
    background-color: var(--light-color) !important;
}

.text-primary {
    color: var(--primary-color) !important;
}

.text-success {
    color: var(--success-color) !important;
}

.text-muted {
    color: var(--text-secondary) !important;
}

/* ===== NOTIFICATION STYLES ===== */
.alert {
    border: none;
    border-radius: 10px;
    box-shadow: var(--shadow);
    animation: slideInRight 0.3s ease;
    font-weight: 600;
    min-width: 350px;
    z-index: 10000;
}

.alert-success {
    background: linear-gradient(135deg, #198754, #146c43);
    color: white;
    border-left: 5px solid #0f5132;
}

.alert-error {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
    border-left: 5px solid #a71e2a;
}

.alert-warning {
    background: linear-gradient(135deg, #ffc107, #e0a800);
    color: #212529;
    border-left: 5px solid #b45309;
}

.alert-info {
    background: linear-gradient(135deg, #0dcaf0, #0aa2c0);
    color: white;
    border-left: 5px solid #055160;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== HIGHLIGHT STYLES ===== */
mark {
    background-color: #fff3cd;
    color: #856404;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 600;
}

/* ===== RESPONSIVE STYLES ===== */
@media (max-width: 768px) {
    .container-fluid {
        padding: 10px;
    }
    
    .card-body {
        padding: 15px;
    }
    
    .contact-list-item {
        padding: 10px;
    }
    
    .contact-list-item .contact-avatar {
        width: 40px;
        height: 40px;
    }
    
    .search-results-container {
        max-height: 300px;
    }
    
    .modal-dialog {
        margin: 10px;
    }
}

@media (max-width: 576px) {
    h1 {
        font-size: 1.8rem;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 0.9em;
    }
    
    .contact-list-container {
        height: 400px !important;
    }
}

/* ===== SCROLLBAR STYLES ===== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-color);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ===== ANIMATION STYLES ===== */
.fade-in {
    animation: fadeIn 0.5s ease;
}

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

.slide-up {
    animation: slideUp 0.3s ease;
}

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

/* ===== UTILITY CLASSES ===== */
.text-center {
    text-align: center;
}

.text-white {
    color: white !important;
}

.text-light {
    color: #f8f9fa !important;
}

.shadow-lg {
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175) !important;
}

.border-end {
    border-right: 1px solid var(--border-color) !important;
}

.me-2 {
    margin-right: 0.5rem !important;
}

.me-3 {
    margin-right: 1rem !important;
}

.mb-0 {
    margin-bottom: 0 !important;
}

.mb-2 {
    margin-bottom: 0.5rem !important;
}

.mb-3 {
    margin-bottom: 1rem !important;
}

.mb-4 {
    margin-bottom: 1.5rem !important;
}

.mt-4 {
    margin-top: 1.5rem !important;
}

.mt-5 {
    margin-top: 3rem !important;
}

.py-4 {
    padding-top: 1.5rem !important;
    padding-bottom: 1.5rem !important;
}

.p-0 {
    padding: 0 !important;
}

.p-3 {
    padding: 1rem !important;
}

.p-4 {
    padding: 1.5rem !important;
}

.g-0 {
    --bs-gutter-x: 0;
    --bs-gutter-y: 0;
}

.gap-2 {
    gap: 0.5rem !important;
}

.w-100 {
    width: 100% !important;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.125rem;
    border-radius: 0.5rem;
}

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

.position-relative {
    position: relative !important;
}

.position-fixed {
    position: fixed !important;
}

.d-flex {
    display: flex !important;
}

.align-items-center {
    align-items: center !important;
}

.justify-content-between {
    justify-content: space-between !important;
}

.justify-content-center {
    justify-content: center !important;
}

.flex-grow-1 {
    flex-grow: 1 !important;
}

.d-grid {
    display: grid !important;
}

.rounded {
    border-radius: 0.375rem !important;
}

.rounded-3 {
    border-radius: 0.5rem !important;
}

.overflow-hidden {
    overflow: hidden !important;
}

.overflow-y-auto {
    overflow-y: auto !important;
}

/* ===== FOOTER STYLES ===== */
footer {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

footer a {
    text-decoration: none;
    transition: var(--transition);
}

footer a:hover {
    color: var(--primary-color) !important;
    text-decoration: underline;
}