/**
 * Minimal CSS for Contact Manager
 * Clean and simple styling
 */

/* Security: Disable text selection */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
    -webkit-touch-callout: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

/* Allow selection only for input and textarea fields (but they will be protected by JS) */
input, textarea {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
}

/* Disable selection on table cells and contact data */
table td, table th, .contact-data, .table-container {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
    cursor: default !important;
}

/* Disable text selection highlight */
::selection {
    background: transparent !important;
    color: inherit !important;
}

::-moz-selection {
    background: transparent !important;
    color: inherit !important;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Login page container */
body:not(.dashboard-body) .container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

@media (max-width: 768px) {
    body:not(.dashboard-body) .container {
        padding: 15px;
        min-height: calc(100vh - 30px);
    }
}

@media (max-width: 480px) {
    body:not(.dashboard-body) .container {
        padding: 10px;
        min-height: calc(100vh - 20px);
    }
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    height: 100vh;
    background: #2c3e50;
    color: white;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
}

.sidebar-header {
    padding: 20px;
    background: #1a252f;
    border-bottom: 1px solid #34495e;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-text {
    color: white;
    font-size: 18px;
    font-weight: 600;
    white-space: nowrap;
}

.sidebar-header h2 {
    color: white;
    font-size: 20px;
    margin: 0;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav > ul > li {
    margin: 5px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #ecf0f1;
    text-decoration: none;
    transition: all 0.3s;
    cursor: pointer;
}

.nav-item:hover {
    background: #34495e;
    color: white;
}

.nav-item.active {
    background: #3498db;
    color: white;
}

.nav-icon {
    margin-right: 12px;
    font-size: 16px;
    width: 24px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.nav-icon i {
    font-size: 16px;
    display: inline-block;
    font-style: normal;
    font-variant: normal;
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
}

.nav-dropdown {
    position: relative;
}

.dropdown-arrow {
    margin-left: auto;
    font-size: 10px;
    transition: transform 0.3s;
}

.dropdown-arrow i {
    font-size: 10px;
}

.nav-dropdown.active .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    display: none;
    background: #1a252f;
    padding: 5px 0;
    margin-top: 5px;
}

.nav-dropdown.active .dropdown-menu {
    display: block;
}

.dropdown-menu li {
    margin: 0;
}

.dropdown-menu a {
    display: flex;
    align-items: center;
    padding: 10px 20px 10px 50px;
    color: #bdc3c7;
    text-decoration: none;
    transition: all 0.3s;
    gap: 8px;
}

.dropdown-menu a i {
    font-size: 12px;
    width: 16px;
    display: inline-block;
    font-style: normal;
    font-variant: normal;
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
}

.dropdown-menu a:hover {
    background: #34495e;
    color: white;
    padding-left: 55px;
}

.sidebar-footer {
    padding: 15px 20px;
    background: #1a252f;
    border-top: 1px solid #34495e;
}

.user-info-sidebar {
    text-align: center;
}

.user-name {
    color: #ecf0f1;
    font-size: 14px;
    font-weight: 500;
}

/* Main Wrapper */
.main-wrapper {
    margin-left: 260px;
    min-height: 100vh;
    background: #f5f5f5;
}

.top-header {
    background: white;
    padding: 15px 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.top-header h1 {
    font-size: 24px;
    color: #2c3e50;
    margin: 0;
    flex-shrink: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-left: auto;
    flex-shrink: 0;
}

.welcome-text {
    color: #555;
    font-size: 14px;
    white-space: nowrap;
}

.main-content {
    padding: 30px;
}

/* Search Box */
.search-container {
    margin-bottom: 20px;
}

.search-box {
    position: relative;
    max-width: 500px;
    display: flex;
    align-items: center;
}

.search-box i.fa-search {
    position: absolute;
    left: 15px;
    color: #7f8c8d;
    z-index: 1;
}

.search-box input {
    width: 100%;
    padding: 12px 45px 12px 45px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s;
}

.search-box input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.btn-clear {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: #7f8c8d;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.btn-clear:hover {
    color: #e74c3c;
}

/* Pagination */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.pagination-info {
    color: #555;
    font-size: 14px;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-pagination {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: white;
    color: #555;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
}

.btn-pagination:hover:not(:disabled) {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.btn-pagination:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-numbers {
    display: flex;
    gap: 5px;
    align-items: center;
}

.page-number {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: white;
    color: #555;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-number:hover {
    background: #f8f9fa;
    border-color: #3498db;
}

.page-number.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.page-ellipsis {
    padding: 0 5px;
    color: #7f8c8d;
}

/* Old Header (for login page) */
header {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 24px;
    color: #2c3e50;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Login Page */
.login-box {
    max-width: 400px;
    margin: 100px auto;
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    width: 100%;
}

.login-logo {
    text-align: center;
    margin-bottom: 15px;
}

.login-logo svg {
    display: block;
    margin: 0 auto;
}

.login-box h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 28px;
}

.login-box h2 {
    text-align: center;
    color: #7f8c8d;
    margin-bottom: 30px;
    font-size: 20px;
    font-weight: normal;
}

.error-message {
    background: #fee;
    color: #c33;
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 20px;
    border-left: 4px solid #c33;
    font-size: 14px;
}

.login-info {
    margin-top: 30px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 14px;
}

.login-info p {
    margin: 5px 0;
}

.login-info code {
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    word-break: break-all;
}

/* Login Page Responsive */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .login-box {
        margin: 30px auto;
        padding: 30px 20px;
        max-width: 100%;
    }
    
    .login-logo svg {
        width: 60px;
        height: 60px;
    }
    
    .login-box h1 {
        font-size: 24px;
        margin-bottom: 8px;
    }
    
    .logo-container {
        gap: 10px;
    }
    
    .logo-text {
        font-size: 16px;
    }
    
    .sidebar-header {
        padding: 15px;
    }
    
    .logo-container svg {
        width: 32px;
        height: 32px;
    }
    
    .login-box h2 {
        font-size: 18px;
        margin-bottom: 25px;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-group label {
        font-size: 14px;
    }
    
    .form-group input {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px;
    }
    
    .btn {
        width: 100%;
        padding: 12px;
        font-size: 16px;
    }
    
    .login-info {
        margin-top: 20px;
        padding: 12px;
        font-size: 13px;
    }
    
    .error-message {
        padding: 10px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .login-box {
        margin: 20px auto;
        padding: 25px 15px;
        border-radius: 6px;
    }
    
    .login-logo svg {
        width: 50px;
        height: 50px;
    }
    
    .login-box h1 {
        font-size: 22px;
        margin-bottom: 5px;
    }
    
    .logo-container {
        gap: 8px;
    }
    
    .logo-text {
        font-size: 14px;
    }
    
    .sidebar-header {
        padding: 12px;
    }
    
    .logo-container svg {
        width: 28px;
        height: 28px;
    }
    
    .login-box h2 {
        font-size: 16px;
        margin-bottom: 20px;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-group label {
        font-size: 13px;
        margin-bottom: 6px;
    }
    
    .form-group input {
        font-size: 16px;
        padding: 12px 10px;
        width: 100%;
    }
    
    .btn {
        width: 100%;
        padding: 14px;
        font-size: 16px;
        margin-top: 5px;
    }
    
    .login-info {
        margin-top: 15px;
        padding: 10px;
        font-size: 12px;
    }
    
    .login-info p {
        margin: 4px 0;
    }
    
    .login-info code {
        font-size: 11px;
        padding: 2px 4px;
    }
    
    .error-message {
        padding: 10px;
        font-size: 12px;
        margin-bottom: 15px;
    }
}

/* Touch-friendly for login */
@media (hover: none) and (pointer: coarse) {
    .login-box .form-group input {
        min-height: 44px;
        font-size: 16px; /* Prevents iOS zoom */
    }
    
    .login-box .btn {
        min-height: 44px;
    }
}

/* Dashboard */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.dashboard-header h2 {
    color: #2c3e50;
}

main {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-small {
    padding: 5px 12px;
    font-size: 12px;
}

.btn-edit {
    background: #f39c12;
    color: white;
    margin-right: 5px;
}

.btn-edit:hover {
    background: #e67e22;
}

.btn-delete {
    background: #e74c3c;
    color: white;
}

.btn-delete:hover {
    background: #c0392b;
}

/* Form */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    overflow: auto;
}

.modal-content {
    background: white;
    margin: 50px auto;
    padding: 30px;
    border-radius: 8px;
    max-width: 500px;
    position: relative;
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #2c3e50;
}

/* Delete Confirmation Modal */
.delete-modal {
    text-align: center;
    max-width: 400px;
}

.delete-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.delete-modal h2 {
    color: #e74c3c;
    margin-bottom: 15px;
}

.delete-modal p {
    color: #555;
    margin-bottom: 25px;
    line-height: 1.6;
}

.delete-modal .form-actions {
    justify-content: center;
}

/* Table */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

thead {
    background: #f8f9fa;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    font-weight: 600;
    color: #2c3e50;
}

th:first-child, td:first-child {
    text-align: center;
    width: 60px;
}

tbody tr:hover {
    background: #f8f9fa;
}

.actions {
    white-space: nowrap;
    position: relative;
}

.action-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.action-icons {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-direction: row;
}

.action-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    text-decoration: none;
    transition: all 0.3s;
    font-size: 16px;
    line-height: 1;
    color: white;
}

.action-icon i {
    font-size: 16px;
    display: inline-block;
    font-style: normal;
    font-variant: normal;
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
}

.whatsapp-icon {
    background: #25D366;
    color: white;
}

.whatsapp-icon:hover {
    background: #20BA5A;
    transform: scale(1.1);
}

.call-icon {
    background: #34C759;
    color: white;
}

.call-icon:hover {
    background: #2FB04A;
    transform: scale(1.1);
}

.action-buttons-main {
    display: flex;
    gap: 5px;
    align-items: center;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
    padding: 0;
    line-height: 1;
    color: white;
}

.btn-icon i {
    font-size: 14px;
    display: inline-block;
    font-style: normal;
    font-variant: normal;
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
}

.btn-edit-icon {
    background: #f39c12;
    color: white;
}

.btn-edit-icon:hover {
    background: #e67e22;
    transform: scale(1.1);
}

.btn-delete-icon {
    background: #e74c3c;
    color: white;
}

.btn-delete-icon:hover {
    background: #c0392b;
    transform: scale(1.1);
}

.loading, .no-data {
    text-align: center;
    padding: 40px;
    color: #7f8c8d;
}

/* Toastr customization */
#toast-container {
    top: 20px;
    right: 20px;
}

/* Mobile Menu Toggle Button */
.mobile-menu-btn {
    display: none;
    background: #3498db;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 18px;
    margin-right: 15px;
}

.mobile-menu-btn i {
    font-size: 18px;
}

.header-left {
    display: flex;
    align-items: center;
}

/* Sidebar Overlay for Mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }
    
    .main-wrapper {
        margin-left: 240px;
    }
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block;
    }
    
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .sidebar-overlay.active {
        display: block;
    }
    
    .main-wrapper {
        margin-left: 0;
    }
    
    .top-header {
        padding: 12px 15px;
        position: sticky;
        top: 0;
        z-index: 100;
    }
    
    .header-content {
        flex-wrap: wrap;
    }
    
    .header-left {
        flex: 1;
        min-width: 0;
    }
    
    .top-header h1 {
        font-size: 20px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .header-actions {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .welcome-text {
        font-size: 12px;
        white-space: nowrap;
    }
    
    .main-content {
        padding: 15px;
    }
    
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .dashboard-header h2 {
        font-size: 20px;
    }
    
    .search-container {
        margin-bottom: 15px;
    }
    
    .search-box {
        max-width: 100%;
    }
    
    .search-box input {
        padding: 10px 40px 10px 40px;
        font-size: 14px;
    }
    
    /* Table Responsive */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        font-size: 12px;
        min-width: 800px;
    }
    
    th, td {
        padding: 8px 6px;
        white-space: nowrap;
    }
    
    th:first-child, td:first-child {
        width: 50px;
        padding: 8px 4px;
    }
    
    /* Hide some columns on very small screens */
    @media (max-width: 480px) {
        table {
            min-width: 700px;
        }
        
        th:nth-child(4), td:nth-child(4) {
            display: none; /* Hide Remarks on very small screens */
        }
    }
    
    /* Modal Responsive */
    .modal-content {
        margin: 10px;
        padding: 20px;
        max-width: calc(100% - 20px);
    }
    
    .modal-content h2 {
        font-size: 20px;
    }
    
    .form-group label {
        font-size: 14px;
    }
    
    .form-group input,
    .form-group textarea {
        font-size: 14px;
        padding: 10px;
    }
    
    /* Pagination Responsive */
    .pagination-container {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    .pagination-info {
        text-align: center;
        font-size: 13px;
    }
    
    .pagination-controls {
        flex-wrap: wrap;
        justify-content: center;
        gap: 5px;
    }
    
    .btn-pagination {
        min-width: 32px;
        height: 32px;
        padding: 6px 8px;
        font-size: 12px;
    }
    
    .page-number {
        min-width: 32px;
        height: 32px;
        padding: 6px 8px;
        font-size: 12px;
    }
    
    /* Buttons Responsive */
    .btn {
        padding: 10px 15px;
        font-size: 13px;
    }
    
    .btn-icon {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }
    
    .action-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .action-icon i {
        font-size: 14px;
    }
    
    /* Delete Modal Responsive */
    .delete-modal {
        max-width: calc(100% - 20px);
        padding: 20px;
    }
    
    .delete-icon {
        font-size: 36px;
    }
    
    .delete-modal h2 {
        font-size: 18px;
    }
    
    .delete-modal p {
        font-size: 14px;
    }
    
    /* Login Page Responsive */
    .login-box {
        margin: 50px auto;
        padding: 30px 20px;
        max-width: calc(100% - 20px);
    }
    
    .login-box h1 {
        font-size: 22px;
    }
    
    .login-box h2 {
        font-size: 18px;
    }
    
    header {
        flex-direction: column;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .top-header {
        padding: 10px 12px;
    }
    
    .top-header h1 {
        font-size: 18px;
    }
    
    .welcome-text {
        display: none; /* Hide welcome text on very small screens */
    }
    
    .main-content {
        padding: 10px;
    }
    
    .dashboard-header h2 {
        font-size: 18px;
    }
    
    .search-box input {
        padding: 8px 35px 8px 35px;
        font-size: 13px;
    }
    
    .btn {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .modal-content {
        padding: 15px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
    }
    
    .pagination-controls {
        gap: 3px;
    }
    
    .page-numbers {
        gap: 3px;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .btn, .btn-icon, .action-icon, .page-number, .btn-pagination {
        min-height: 44px; /* iOS recommended touch target */
        min-width: 44px;
    }
    
    .nav-item {
        min-height: 44px;
    }
    
    .search-box input {
        min-height: 44px;
    }
}

