/* 1. Root Variables */
:root {
    /* Colors */
    --primary-color: #009879;
    --primary-dark: #007857;
    --primary-light: #52d3a2;
    --secondary-color: #28a745;
    --secondary-dark: #1e7e34;
    --primary-light-transparent: rgba(0,152,121,0.1);
    
    /* Neutral colors */
    --background-color: #f4f4f4;
    --text-color: #333;
    --border-color: #ddd;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-background: #f9f9f9;
    --light-border: #eee;
    
    /* Status colors */
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
    --header-text-color: #333;
    --header-background: #f4f4f4;
    --hover-color: #218838;
    --table-header-text-color: #fff;
    --box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    --padding: 12px;
    
    /* Typography */
    --font-family: 'Arial', sans-serif;
    --font-size-base: 16px;
    --font-size-sm: 14px;
    --font-size-lg: 18px;
    --line-height-base: 1.5;
    
    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    
    /* Border radius */
    --border-radius-sm: 4px;
    --border-radius-md: 8px;
    --border-radius-lg: 16px;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.12);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 300ms ease;
    --transition-slow: 500ms ease;
    
    /* Z-index layers */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-modal: 1030;
    --z-popover: 1040;
    --z-tooltip: 1050;
}

/* 2. Base Styles */
body {
    font-family: Arial, sans-serif;
    background-color: var(--background-color);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    color: var(--text-color);
    font-size: 16px;
}

h1, h2 {
    color: var(--text-color);
    margin-top: 0;
    margin-bottom: 10px;
}

h1 {
    font-size: 1.5em;
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* 3. Layout Components */
.container {
    width: 95%;
    max-width: 1400px;
    margin: auto;
    overflow: hidden;
    margin-top: 5px;
    padding-bottom: 50px; /* Keep this; it's overridden in mobile styles */
}

.table-container {
    margin: 20px 0;
    width: 100%;
    overflow-x: auto;
}

/* 4. Header Styles - Restored to original */
header {
    background: var(--header-background);
    color: var(--header-text-color);
    padding: 5px 0;
    width: 100%;
    margin-bottom: 5px;
}

header a {
    color: var(--header-text-color);
    text-decoration: none;
    text-transform: uppercase;
    font-size: 16px;
}

header ul {
    padding: 0;
    list-style: none;
    text-align: center;
}

header li {
    display: block;
    padding: 10px 0;
}

header #branding {
    float: left;
    padding-left: 15px;
}

header #branding h1 {
    margin: 0;
    color: var(--header-text-color);
}

header nav {
    float: right;
    margin-top: 10px;
    padding-right: 15px;
}

/* Desktop navigation */
@media screen and (min-width: 768px) {
    header nav {
        float: right;
        margin-top: 0;
    }

    header ul {
        text-align: right;
    }

    header li {
        display: inline-block;
        padding: 0 15px;
    }
}

/* 5. Table Styles */
.table-wrapper {
    position: relative;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: var(--spacing-md) 0;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-sm);
    background: white;
    width: 100%;
}

table, .styled-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    table-layout: auto;
    background: #fff;
    box-shadow: var(--box-shadow);
    font-size: var(--font-size-sm);
}

.styled-table th {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
    text-align: left;
    padding: var(--spacing-sm) var(--spacing-md);
    border-bottom: 2px solid var(--primary-dark);
    position: sticky;
    top: 0;
    z-index: 2;
}

.styled-table td {
    padding: var(--spacing-sm) var(--spacing-md);
    border-bottom: 1px solid var(--gray-200);
    transition: background-color var(--transition-fast);
    text-align: left;
}

th, td {
    padding: var(--padding);
    border: 1px solid var(--border-color);
    text-align: center;
    min-width: 100px;
    word-wrap: break-word;
}

th {
    background: var(--primary-color);
    color: var(--table-header-text-color);
}

th a {
    color: var(--table-header-text-color);
    text-decoration: none;
}

th a:hover {
    text-decoration: underline;
}

.styled-table tbody tr:hover {
    background-color: var(--primary-light-transparent);
}

tr:nth-child(even), .styled-table tbody tr:nth-of-type(even) {
    background-color: #f9f9f9;
}

.styled-table tbody tr:last-of-type {
    border-bottom: 2px solid var(--primary-color);
}

.styled-table tbody tr.active-row {
    font-weight: bold;
    color: var(--primary-color);
}

.no-results {
    background-color: #f9f9f9;
}

/* Sortable table styles */
.sortable {
    cursor: pointer;
    position: relative;
    padding-right: 25px;
    user-select: none;
}

.sort-icon {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.7;
}

.sortable:hover {
    background-color: var(--primary-dark);
    color: white;
}

.sortable:hover .sort-icon {
    opacity: 1;
    color: white;
    transform: scale(1.2);
    transition: all 0.2s ease;
}

.sort-icon.active {
    color: #fff;
    text-shadow: 0 0 2px rgba(0,0,0,0.3);
}

/* 6. Form Controls - Fixed for proper display */
.call-controls, 
.device-controls, 
.user-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 10px 0;
    width: 100%;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

/* Search controls */
.search-input, 
#call-search,
#searchInput,
.filter-select,
#deviceFilter {
    width: 100%;
    min-width: 150px;
}

.export-button {
    width: 100%;
    margin-left: 0;
}

/* Desktop layout */
@media screen and (min-width: 768px) {
    .call-controls, 
    .device-controls, 
    .user-controls {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .filter-group {
        flex-direction: row;
        align-items: center;
        width: auto;
        flex: 1;
    }

    .search-input, 
    #call-search,
    #searchInput {
        max-width: 300px;
    }

    .filter-select,
    #deviceFilter {
        max-width: 200px;
    }

    .export-button {
        width: auto;
        min-width: 100px;
        margin-left: auto;
    }
    
    input[type="date"] {
        min-width: 130px;
        width: auto;
    }
}

/* Form Elements */
form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

input[type="text"], input[type="password"], select, textarea {
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    width: 100%;
    box-sizing: border-box;
    outline: none;
}

input[type="text"]:focus, input[type="password"]:focus, select:focus, textarea:focus {
    border-color: var(--primary-color);
}

/* Search form */
.search-form {
    display: flex;
    gap: 10px;
}

.search-form input[type="text"] {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 300px;
}

.search-form button {
    padding: 8px 16px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.search-form button:hover {
    background-color: var(--primary-dark);
}

.search-form button:active {
    transform: scale(0.95);
}

/* Form element width adjustments */
.search-input, 
#call-search,
#searchInput,
.filter-select,
#deviceFilter {
    flex: 1;
    min-width: 150px;
    max-width: 300px;
}

input[type="date"] {
    min-width: 130px;
    width: auto;
}

.export-button {
    width: auto;
    min-width: 100px;
    margin-left: auto;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0;
}

/* 7. Button Styles */
button, .edit-button, .delete-button, .edit-user-link, .delete-user, .edit-device {
    background: var(--secondary-color);
    color: white;
    padding: 10px 15px;
    font-size: 14px;
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    border-radius: 4px;
}

button:hover, .edit-button:hover, .edit-user-link:hover, .edit-device:hover {
    background: var(--hover-color);
    opacity: 0.9;
}

button:active, .edit-button:active, .delete-button:active, .edit-user-link:active, .delete-user:active, .edit-device:active {
    transform: scale(0.95);
}

.delete-button, .delete-user {
    background-color: #dc3545;
}

.delete-button:hover, .delete-user:hover {
    background-color: #c82333;
    opacity: 0.9;
}

/* Styled buttons */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-base);
    font-weight: 500;
    line-height: 1.5;
    border-radius: var(--border-radius-sm);
    border: 1px solid transparent;
    transition: all var(--transition-normal);
    cursor: pointer;
    white-space: nowrap;
}

.button-primary {
    background-color: var(--primary-color);
    color: white;
}

.button-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.button-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.button-danger {
    background-color: var(--danger-color);
    color: white;
}

.button:active {
    transform: translateY(1px);
}

.button:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.answer-call {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
}

.answer-call:hover {
    background: var(--primary-dark);
}

.answer-call:active {
    transform: scale(0.95);
}

/* 8. Stats and Call Styles */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-md);
    margin: var(--spacing-md) 0;
    width: 100%;
    margin-top: 0px;
}

.stat-box {
    background: white;
    padding: var(--spacing-md);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
    transition: transform 0.2s;
}

.stat-box:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.stat-box h3 {
    margin: 0;
    font-size: var(--font-size-sm);
    text-transform: uppercase;
    color: var(--gray-500);
}

.stat-box p {
    margin: var(--spacing-sm) 0 0;
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--primary-color);
}

.recent-calls {
    margin-top: 20px;
}

/* Call stats */
.call-stats {
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-around;
    align-items: center;
    margin: 20px 0;
}

.call-stats span {
    margin: 0;
    padding: 0 10px;
    font-size: 1.2em;
    display: flex;
    align-items: center;
}

.call-stats i {
    margin-right: 5px;
}

/* Call table */
#calls-table td {
    font-size: 14px;
}

#calls-table td:first-child {
    white-space: nowrap;
}

/* Call status */
.call-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.9em;
    font-weight: 500;
    text-align: center;
    min-width: 100px;
}

.call-status.pending {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.call-status.answered {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.call-status.missed {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.answer-info {
    margin-top: 5px;
    font-size: 0.85em;
    color: #6c757d;
}

.answer-info small {
    display: block;
    line-height: 1.4;
}

/* 9. User Access Styles */
.user-access {
    width: 100%;
    min-height: 100px;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 5px;
}

#add-device-link {
    margin-bottom: 20px;
}

.device-actions {
    display: flex;
    gap: 10px;
}

textarea#description {
    width: 100%;
    min-height: 100px;
    margin-bottom: 15px;
}

/* 10. Login Styles */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: #f5f5f5;
}

.login-form {
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.login-form h1 {
    text-align: center;
    color: #333;
    margin-bottom: 1.5rem;
}

.login-form input {
    width: 100%;
    padding: 10px;
    margin: 8px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

.login-form button {
    width: 100%;
    padding: 10px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 1rem;
}

.login-form button:hover {
    background-color: var(--primary-dark);
}

.login-form button:active {
    transform: scale(0.95);
}

.error-message {
    color: #dc3545;
    text-align: center;
    margin: 10px 0;
    padding: 10px;
    background-color: #ffebee;
    border-radius: 4px;
}

/* 11. Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    position: relative;
    background-color: #fff;
    padding: 20px;
    width: 90%;
    max-width: 500px;
    border-radius: 5px;
}

.close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    line-height: 1;
    z-index: 1002;
}

.close:hover {
    color: #333;
}

/* Device Modal */
#device-modal .modal-content {
    max-height: 80vh;
    overflow-y: auto;
    padding: 20px;
}

#device-modal form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
}

#device-modal .form-bottom {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    margin-top: 10px;
}

#device-modal .access-management {
    flex: 1;
    margin: 0;
}

#device-modal button[type="submit"] {
    height: 40px;
    min-width: 100px;
    margin-top: 25px;
}

#device-modal select[multiple] {
    width: 100%;
    min-height: 100px;
}

#device-modal textarea {
    min-height: 40px;
    max-height: 80px;
    resize: vertical;
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin: 0;
}

/* Notification Modal */
.notification-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.notification-modal.show {
    display: flex;
    opacity: 1;
}

.notification-modal-content {
    background-color: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.3);
    max-width: 500px;
    width: 90%;
    transform: translateY(30px);
    transition: transform 0.3s;
}

.notification-modal.show .notification-modal-content {
    transform: translateY(0);
}

.notification-modal-buttons {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

.notification-modal-buttons button {
    padding: 10px 15px;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    border: none;
}

.notification-modal-buttons .btn-primary {
    background-color: #28a745;
    color: white;
}

.notification-modal-buttons .btn-secondary {
    background-color: #6c757d;
    color: white;
}

/* 12. Notification Styles */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 4px;
    color: white;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.notification.success {
    background-color: #009879;
}

.notification.error {
    background-color: #ff4444;
}

/* Status Indicator */
.notification-indicator {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    padding: 8px 15px;
    z-index: 1000;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
}

.indicator-title {
    display: none; /* Hide the title to save space */
}

.notification-status {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.notification-item {
    display: flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 20px;
    white-space: nowrap;
}

.notification-item.online {
    background: #d4edda;
    color: #155724;
}

.notification-item.offline {
    background: #f8d7da;
    color: #721c24;
}

.notification-item.reconnecting {
    background: #fff3cd;
    color: #856404;
}

.notification-item.active {
    background: #d4edda;
    color: #155724;
}

.notification-item.inactive {
    background: #f8d7da;
    color: #721c24;
}

.notification-item i {
    margin-right: 8px;
    font-size: 14px;
    width: 16px;
    text-align: center;
}

.notification-option {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.notification-option i {
    margin-right: 12px;
    font-size: 18px;
    width: 24px;
    text-align: center;
    color: #007bff;
}

.notification-option span {
    flex: 1;
}

.notification-info {
    display: flex;
    align-items: flex-start;
    background: #e8f4fd;
    padding: 10px;
    border-radius: 4px;
    margin: 15px 0;
}

.notification-info i {
    color: #007bff;
    margin-right: 10px;
    margin-top: 2px;
}

.status-badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
    background: #f8f9fa;
    color: #6c757d;
}

.status-badge.active {
    background: #28a745;
    color: white;
}

.notification-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

/* Connection Status */
.connection-status {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    opacity: 0.9;
}

.connection-status.online {
    background-color: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #81c784;
}

.connection-status.offline {
    background-color: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

.connection-status:hover {
    opacity: 1;
}

/* Flash Notifications */
.flash-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    color: #333;
    border-radius: 8px;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.2);
    width: 320px;
    transform: translateX(350px);
    transition: transform 0.3s;
    z-index: 1500;
    overflow: hidden;
    border-left: 4px solid #dc3545;
}

.flash-notification.show {
    transform: translateX(0);
}

.flash-title {
    background: #f8f9fa;
    padding: 12px 15px;
    font-weight: bold;
    border-bottom: 1px solid #eee;
}

.flash-message {
    padding: 15px;
}

.flash-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: #666;
    font-size: 20px;
    cursor: pointer;
}

/* 13. Pagination Styles */
.pagination-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 20px 0;
    gap: 10px;
}

.pagination-info {
    color: #666;
    font-size: 0.9em;
}

.pagination {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 5px;
}

.pagination-link {
    display: inline-block;
    padding: 5px 10px;
    margin: 0 2px;
    border: 1px solid #ddd;
    color: var(--primary-color);
    text-decoration: none;
    border-radius: 3px;
    min-width: 30px;
    text-align: center;
    transition: all 0.2s;
}

.pagination-link:hover {
    background-color: #f5f5f5;
    border-color: var(--primary-color);
}

.pagination-link.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    cursor: default;
}

.pagination-link.disabled {
    color: #ccc;
    pointer-events: none;
    border-color: #eee;
}

.pagination-ellipsis {
    padding: 5px;
    color: #666;
}

.items-per-page {
    display: flex;
    align-items: center;
    margin-left: 15px;
    gap: 5px;
}

.items-per-page select {
    padding: 4px;
    border: 1px solid #ddd;
    border-radius: 3px;
}


.quick-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 8px 0;
}

.quick-filter {
    padding: 3px 8px;
    background-color: #f1f1f1;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-filter:hover {
    background-color: #e9e9e9;
    border-color: #aaa;
}

.quick-filter.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color-dark);
}



/* 14. Media Queries (Consolidated) */
@media screen and (max-width: 768px) {
    /* Global container fixes */
    body {
        margin: 0;
        padding: 0;
        overflow-x: hidden;
    }
    
    .container {
        width: 100%;
        padding: 0;
        margin: 0;
        overflow-x: hidden;
        box-sizing: border-box;
        padding-bottom: 60px; /* Space for bottom status bar */
        
    }
    
    /* Consistent padding for container children */
    .container > * {
        padding: 5px 10px;
        box-sizing: border-box;
        max-width: 100%;
    }
    
    /* Form controls for mobile */
    .call-controls, 
    .device-controls, 
    .user-controls {
        flex-direction: column;
        gap: 15px;
        width: 100%;
        padding: 10px;
        box-sizing: border-box;
        max-width: 100%;
    }
    
    .filter-group {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }
    
    /* Search inputs and filters */
    .search-input, 
    #call-search,
    #searchInput,
    .filter-select,
    #deviceFilter,
    .export-button,
    input[type="date"] {
        width: 100%;
        max-width: none;
        margin-left: 0;
    }
    
    /* Table fixes for mobile (dashboard and call_data) */
    .table-wrapper {
        width: 100%;
        margin: 10px 0;
        padding: 0;
        border-radius: 0;
        box-shadow: none;
        overflow-x: hidden;
        max-width: 100%;
    }
    
    /* Hide table headers on mobile */
    .styled-table thead {
        display: none;
    }
    
    /* Full width tables */
    .styled-table, 
    #calls-table {
        display: block;
        width: 100%;
        min-width: 100%;
        max-width: 100%;
        border: none;
        box-shadow: none;
        box-sizing: border-box;
        background-color: var(--background-color) !important; /* Add !important to override other styles */
    }
    
    .styled-table tbody {
        display:block;
        margin: 0px;
        padding: 10px;
        width: 96%;
    }
    
    /* Card-style rows */
    .styled-table tbody tr {
        display: block;
        margin: 0 0 25px 0; /* Increased bottom margin between cards */
        border: 1px solid var(--gray-300);
        border-radius: 8px;
        width: 100%;
        box-sizing: border-box;
        background-color: white;
        box-shadow: 0 3px 8px rgba(0,0,0,0.08); /* Enhanced shadow */
        overflow: hidden;
    }
    
    /* Full width cells with better layout and more padding */
    .styled-table td {
        display: flex;
        justify-content: space-between;
        width: 100%;
        min-width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        border-bottom: 1px solid var(--gray-300);
        padding: 18px 16px; /* Increased vertical padding */
        margin: 0 0 2px 0; /* Added small margin between cells */
        align-items: center;
        flex: 1 1 100%;
    }
    
    /* Enhanced visual separation between cells with different backgrounds */
    .styled-table td:nth-child(odd) {
        background-color: rgba(249, 249, 249, 0.8); /* Slightly more pronounced */
    }
    
    .styled-table td:nth-child(even) {
        background-color: rgba(255, 255, 255, 0.9); /* Slightly different white */
    }
    
    /* Data labels with better spacing */
    .styled-table td::before {
        content: attr(data-label);
        font-weight: 600;
        flex: 0 0 38%; /* Slightly reduced to give more space for content */
        text-align: left;
        margin-right: 15px; /* Increased margin between label and content */
        padding-right: 15px; /* Increased padding */
        color: #333;
        font-size: 0.9em;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    /* Add subtle divider between label and content - make more visible */
    .styled-table td::after {
        content: "";
        position: absolute;
        left: 40%;
        top: 12px; /* Reduced to make line longer */
        bottom: 12px; /* Reduced to make line longer */
        width: 1px;
        background-color: var(--gray-300); /* Slightly darker divider */
    }
    
    
    /* Enhanced missed call indicator */
    .styled-table tr .call-status.missed {
        background-color: #ffebee;
        color: #c62828;
        padding: 6px 12px;
        border: 1px solid #ef9a9a;
        font-weight: 600;
    }
    
    /* Left border indicator for missed calls */
    .styled-table tbody tr:has(.call-status.missed) {
        border-left: 4px solid #c62828;
    }

    /* Enhanced answered call indicator */
    .styled-table tr .call-status.answered {
        background-color: #d4edda;
        color: #155724;
        padding: 6px 12px;
        border: 1px solid #c3e6cb;
        font-weight: 600;
        border-radius: 4px;
    }
    
    /* Left border indicator for answered calls */
    .styled-table tbody tr:has(.call-status.answered) {
        border-left: 4px solid #006920;
    }
    
    /* Pagination mobile fixes */
    .pagination-container {
        padding: 0 10px;
        box-sizing: border-box;
        max-width: 100%;
    }
    
    .pagination {
        flex-direction: column;
        align-items: center;
        width: 100%;
    }
    
    .pagination-link {
        margin: 2px 0;
        width: 100%;
        text-align: center;
    }
    
    .items-per-page {
        margin: 10px 0 0 0;
    }
    
    /* Status indicator adjustments */
    .notification-status {
        width: 100%;
        justify-content: space-around;
    }
    
    .notification-item span {
        font-size: 12px;
    }
    
    /* Button layout in modals */
    .notification-modal-buttons {
        flex-direction: column;
    }
    
    .notification-modal-buttons button {
        width: 100%;
    }
    
    /* Flash notifications */
    .flash-notification {
        width: calc(100% - 40px);
    }
    
    /* Quick filter adjustments */
    .quick-filters {
        width: 100%;
        justify-content: space-between;
    }
    
    .quick-filter {
        flex: 1;
        text-align: center;
        white-space: nowrap;
    }
    
    /* Improved visual differentiation for table cells */
    
    /* Data labels with better contrast and visual hierarchy */
    .styled-table td::before {
        content: attr(data-label);
        font-weight: 600;
        flex: 0 0 40%;
        text-align: left;
        margin-right: 10px;
        padding-right: 10px;
        color: #333;
        font-size: 0.9em;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    /* Different styling for different types of data */
    
    /* Timestamps - monospace font for better readability */
    .styled-table td[data-label="Vreme"], 
    .styled-table td[data-label="Datum"],
    .styled-table td[data-label="Datum i vreme"] {
        font-family: monospace;
        padding-left: 14px;
    }
    
    /* Phone numbers - easier to read */
    .styled-table td[data-label="Broj"],
    .styled-table td[data-label="Telefon"],
    .styled-table td[data-label="Pozvao"] {
        font-family: monospace;
        font-size: 1.1em;
        font-weight: 500;
        letter-spacing: 0.5px;
        border-left: 2px solid var(--primary-color);
        padding-left: 14px;
    }
    
    /* Duration cells */
    .styled-table td[data-label="Trajanje"] {
        border-left: 2px solid var(--secondary-color);
        padding-left: 14px;
    }
    
    /* Status cells with more emphasis */
    .styled-table td[data-label="Status"] {
        background-color: #f8f9fa;
        border-left: 3px solid var(--gray-400);
        padding-left: 14px;
    }
    
    /* Enhanced separation between cells */
    .styled-table td {
        position: relative;
        border-bottom: 1px solid var(--gray-300);
        padding: 16px;
    }
    
    /* Add subtle divider between label and content */
    .styled-table td::after {
        content: "";
        position: absolute;
        left: 40%;
        top: 14px;
        bottom: 14px;
        width: 1px;
        background-color: var(--gray-200);
    }
    
    /* Enhanced missed call styling */
    .styled-table td .call-status.missed {
        background-color: #ffebee;
        color: #c62828;
        padding: 6px 12px;
        border: 1px solid #ef9a9a;
        font-weight: 600;
        border-radius: 4px;
        display: inline-block;
        min-width: 100px;
        text-align: center;
    }
    
    /* Top cell in each card-style row */
    .styled-table tbody tr td:first-child {
        background-color: var(--gray-100);
        border-radius: 8px 8px 0 0;
        border-top: none;
        border-bottom: 1px solid var(--gray-300);
    }
    
    /* Bottom cell in each card-style row */
    .styled-table tbody tr td:last-child {
        border-radius: 0 0 8px 8px;
        border-bottom: none;
    }
}

@media print {
  .notification-indicator, 
  .call-controls, 
  .pagination-container {
    display: none;
  }
}

