/* Custom CSS for CDR Dashboard */

body {
    display: flex;
    min-height: 100vh;
    flex-direction: column;
}

main {
    flex: 1 0 auto;
}

/* Card improvements */
.card {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.card-title {
    font-weight: 500 !important;
}

/* Table improvements */
table.striped tbody tr:nth-child(odd) {
    background-color: #f5f5f5;
}

table.highlight tbody tr:hover {
    background-color: #e3f2fd;
}

/* Badge improvements */
.badge {
    border-radius: 12px;
    padding: 4px 12px;
    font-size: 0.9rem;
}

/* Modal improvements */
.modal {
    border-radius: 8px;
    max-height: 90%;
}

.modal-fixed-footer {
    max-height: 90%;
}

/* Button improvements */
.btn, .btn-small, .btn-large {
    border-radius: 4px;
    text-transform: none;
    font-weight: 500;
}

/* Input field improvements */
.input-field input:focus {
    border-bottom: 2px solid #1976d2 !important;
    box-shadow: 0 1px 0 0 #1976d2 !important;
}

.input-field input:focus + label {
    color: #1976d2 !important;
}

/* Collection improvements */
.collection .collection-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Tabs improvements */
.tabs {
    background-color: transparent;
}

.tabs .tab a {
    color: #1976d2;
}

.tabs .tab a:hover {
    color: #1565c0;
}

.tabs .tab a.active {
    color: #1976d2;
    font-weight: 500;
}

.tabs .indicator {
    background-color: #1976d2;
}

/* Table wrapper for horizontal scrolling */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
    margin-bottom: 10px;
}

/* Add shadow to indicate scrollable content */
.table-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 30px;
    background: linear-gradient(to left, rgba(255,255,255,0.9), transparent);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.table-wrapper:not(.scrolled-end)::after {
    opacity: 1;
}

/* Improve table scrollbar appearance */
.table-wrapper::-webkit-scrollbar {
    height: 8px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Sortable table headers */
th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s;
}

th.sortable:hover {
    background-color: #e3f2fd;
}

.sort-indicator {
    display: inline-block;
    margin-left: 5px;
    font-size: 0.8em;
    color: #1976d2;
    min-width: 12px;
}

.sort-indicator.active {
    font-weight: bold;
}

/* Pagination controls */
.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    margin-top: 10px;
    border-top: 1px solid #e0e0e0;
}

.pagination-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.pagination-info select {
    display: inline-block;
    width: auto;
    padding: 5px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.pagination-info span {
    color: #666;
    font-size: 0.9rem;
}

.pagination-buttons {
    display: flex;
    gap: 10px;
}

.pagination-buttons button {
    min-width: 40px;
    padding: 0 10px;
}

.pagination-buttons button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-buttons button i {
    margin: 0;
}

/* Tooltip styling for last call times */
.material-tooltip {
    font-size: 0.9rem;
    padding: 8px 12px;
}

/* Responsive improvements */
@media only screen and (max-width: 600px) {
    /* Navigation */
    nav .brand-logo {
        font-size: 1.2rem;
        left: 50%;
        transform: translateX(-50%);
    }
    
    nav ul li a {
        padding: 0 10px;
    }
    
    /* Container padding */
    .container {
        width: 95% !important;
        padding: 0 10px;
    }
    
    /* Card improvements */
    .card {
        margin: 0.5rem 0 1rem 0;
    }
    
    .card-title {
        font-size: 1.3rem !important;
        line-height: 1.4 !important;
    }
    
    .card-title i.material-icons {
        font-size: 1.3rem;
    }
    
    .card-content h3 {
        font-size: 2rem !important;
        margin: 10px 0;
    }
    
    .card-content p {
        font-size: 0.9rem;
    }
    
    /* Badge improvements */
    .badge {
        font-size: 0.7rem;
        padding: 2px 8px;
    }
    
    /* Table improvements */
    table.responsive-table {
        font-size: 0.85rem;
    }
    
    table.responsive-table th,
    table.responsive-table td {
        padding: 8px 5px;
    }
    
    table.responsive-table th {
        font-size: 0.8rem;
    }
    
    /* Input field improvements */
    .input-field input {
        font-size: 0.9rem;
    }
    
    .input-field .prefix {
        font-size: 1.5rem;
    }
    
    /* Header improvements */
    h4 {
        font-size: 1.8rem !important;
        line-height: 1.3 !important;
    }
    
    h4 i.material-icons {
        font-size: 1.8rem;
    }
    
    /* Row spacing */
    .row {
        margin-bottom: 10px;
    }
    
    .row .col {
        padding: 0 0.5rem;
    }
    
    /* Pagination controls on mobile */
    .pagination-controls {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .pagination-info {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }
    
    .pagination-info select {
        width: 100%;
    }
    
    .pagination-info span {
        text-align: center;
    }
    
    .pagination-buttons {
        justify-content: center;
    }
    
    /* Sortable headers on mobile */
    th.sortable {
        font-size: 0.75rem;
        padding: 8px 3px;
    }
    
    .sort-indicator {
        font-size: 0.7em;
        margin-left: 2px;
    }
}

/* Medium screens (tablets) */
@media only screen and (min-width: 601px) and (max-width: 992px) {
    .container {
        width: 90%;
    }
    
    .card-title {
        font-size: 1.5rem !important;
    }
    
    .card-content h3 {
        font-size: 2.5rem !important;
    }
    
    table.responsive-table {
        font-size: 0.9rem;
    }
}

/* Loading spinner */
.preloader-wrapper.small {
    width: 36px;
    height: 36px;
}

/* Toast improvements */
#toast-container {
    top: auto !important;
    right: auto !important;
    bottom: 10%;
    left: 7%;
}

@media only screen and (max-width: 600px) {
    #toast-container {
        left: 5%;
        right: 5%;
        bottom: 5%;
    }
}
