/* ACM Main Styles */
:root {
    --primary-color: #007cba;
    --primary-dark: #005a87;
    --secondary-color: #6c757d;
    --secondary-dark: #5a6268;
    --success-color: #28a745;
    --warning-color: #e0a800;
    --warning-light: #ffc107;
    --danger-color: #dc3545;
    --danger-dark: #c82333;
    --text-dark: #212529;
    --text-light: #495057;
    --text-muted: #666;
    --bg-light: #f8f9fa;
    --bg-white: #ffffff;
    --border-color: #dee2e6;
    --border-light: #eee;
    --shadow-light: 0 2px 10px rgba(0,0,0,0.1);
    --shadow-medium: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-heavy: 0 10px 30px rgba(0,0,0,0.3);
    --border-radius: 5px;
    --border-radius-lg: 10px;
    --transition: all 0.3s ease;
}

.acm-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-light);
    min-height: 100vh;
}

.acm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: var(--bg-white);
    padding: 20px;
    border-radius: var(--border-radius-lg);
    margin-bottom: 20px;
    box-shadow: var(--shadow-medium);
}

.acm-brand h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.acm-brand p {
    margin: 5px 0 0 0;
    opacity: 0.9;
    font-size: 14px;
}

.acm-actions {
    display: flex;
    gap: 10px;
}

.acm-btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
    font-weight: 500;
}

.acm-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.3);
}

.acm-btn-primary {
    background: var(--bg-white);
    color: var(--primary-color);
    font-weight: bold;
}

.acm-btn-primary:hover {
    background: var(--bg-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.acm-btn-secondary {
    background: var(--secondary-color);
    color: var(--bg-white);
}

.acm-btn-secondary:hover {
    background: var(--secondary-dark);
    transform: translateY(-1px);
}

.acm-btn-warning {
    background: var(--warning-color);
    color: var(--text-dark);
}

.acm-btn-warning:hover {
    background: #d39e00;
    transform: translateY(-1px);
}

.acm-btn-danger {
    background: var(--danger-color);
    color: var(--bg-white);
}

.acm-btn-danger:hover {
    background: var(--danger-dark);
    transform: translateY(-1px);
}

/* Fixed Calendar Width */
.acm-calendar-container {
    background: var(--bg-white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-light);
    overflow: hidden;
    width: 100%;
    margin-bottom: 20px;
}

.acm-calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: var(--bg-light);
    border-bottom: 1px solid var(--border-color);
}

.acm-calendar {
    padding: 20px;
    width: 100%;
    overflow-x: auto;
}

/* Calendar Grid Layout */
.acm-calendar-week {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-bottom: 1px solid var(--border-light);
    min-height: 120px;
}

.acm-calendar-week:last-child {
    border-bottom: none;
}

.acm-calendar-date {
    border-right: 1px solid var(--border-light);
    padding: 8px;
    position: relative;
    background: var(--bg-white);
    transition: var(--transition);
    min-height: 120px;
}

.acm-calendar-date:last-child {
    border-right: none;
}

.acm-calendar-date.empty {
    background-color: #f9f9f9;
}

.acm-calendar-date.header-day {
    background-color: #f5f5f5;
    font-weight: bold;
    text-align: center;
    min-height: auto;
    padding: 15px 8px;
    color: var(--text-light);
    font-size: 14px;
}

/* Today highlight */
.acm-calendar-date.today {
    background-color: #fff3e0;
    border: 2px solid var(--warning-light);
}

/* Date number */
.date-number {
    font-weight: bold;
    margin-bottom: 8px;
    color: #333;
    font-size: 14px;
    text-align: center;
    background: #f5f5f5;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    line-height: 28px;
    margin: 0 auto 8px auto;
    display: block;
}

.acm-calendar-date.today .date-number {
    background: var(--warning-light);
    color: var(--bg-white);
}

/* Fix hover effects for calendar cells */
.acm-calendar-date.has-cases {
    position: relative;
    transition: var(--transition);
    background-color: var(--bg-light);
}

.acm-calendar-date.has-cases:hover {
    background-color: #e3f2fd;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Case info inside calendar cells */
.case-info {
    padding: 4px 6px;
    border-radius: 4px;
    margin: 2px 0;
    font-size: 11px;
    cursor: pointer;
    transition: var(--transition);
    border-left: 3px solid #2196f3;
    background-color: var(--bg-white);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.case-info:focus {
    outline: 2px solid #2196f3;
    outline-offset: 1px;
}

.case-info:hover {
    background-color: #2196f3;
    color: var(--bg-white);
    transform: translateX(2px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Smooth hover for case text */
.case-text {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s ease;
    line-height: 1.2;
}

.case-number {
    font-weight: bold;
    font-size: 10px;
}

.client-name {
    font-size: 9px;
    color: #555;
}

.case-info:hover .case-text {
    color: var(--bg-white) !important;
}

.case-info:hover .client-name {
    color: rgba(255,255,255,0.9) !important;
}

/* Cases container in calendar */
.cases-container {
    max-height: 85px;
    overflow-y: auto;
    padding: 2px;
}

.cases-container::-webkit-scrollbar {
    width: 4px;
}

.cases-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

.cases-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

/* Modal Styles */
.acm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.acm-modal-content {
    background: var(--bg-white);
    border-radius: var(--border-radius-lg);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-heavy);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.acm-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-light);
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.acm-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.acm-close:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.acm-close:hover {
    color: #000;
    background: #e9ecef;
}

/* Form Styles */
#acm-case-form {
    padding: 20px;
}

.acm-form-group {
    margin-bottom: 20px;
}

.acm-form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--text-light);
}

.acm-form-row {
    display: flex;
    gap: 15px;
}

.acm-form-row .acm-form-group {
    flex: 1;
}

.acm-form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 14px;
    box-sizing: border-box;
    transition: var(--transition);
}

.acm-form-input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0,124,186,0.1);
}

.acm-form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.acm-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin-bottom: 0;
}

.acm-checkbox-input {
    margin: 0;
}

/* Case History Styles */
.acm-form-section {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 15px;
    margin: 20px 0;
    background: var(--bg-light);
}

.acm-form-section h4 {
    margin: 0 0 15px 0;
    color: var(--primary-color);
    font-size: 16px;
}

.acm-history-items {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    background: #f9f9f9;
    margin-bottom: 15px;
}

.acm-history-item {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 15px;
    margin: 10px 0;
    transition: var(--transition);
}

.acm-history-item:hover {
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.history-date, .history-next-date, .history-notes {
    margin-bottom: 5px;
}

.history-date {
    font-weight: bold;
    color: var(--primary-color);
}

.history-next-date {
    color: var(--success-color);
    font-size: 0.9em;
}

.history-notes {
    color: #555;
    line-height: 1.4;
}

.history-created {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.8em;
    margin-top: 5px;
}

.acm-history-form {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 15px;
    margin-top: 15px;
}

.acm-history-form h5 {
    margin: 0 0 15px 0;
    color: var(--text-light);
}

/* Toast Styles */
.acm-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: var(--border-radius);
    color: var(--bg-white);
    font-weight: bold;
    z-index: 1001;
    display: none;
    box-shadow: var(--shadow-medium);
    animation: toastSlideIn 0.3s ease;
}

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

.acm-toast.success {
    background: var(--success-color);
}

.acm-toast.error {
    background: var(--danger-color);
}

.acm-toast.info {
    background: #17a2b8;
}

.acm-toast.warning {
    background: var(--warning-light);
    color: var(--text-dark);
}

/* Loading state */
.acm-loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-size: 16px;
}

.acm-loading:after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { 
        color: rgba(0,0,0,0); 
        text-shadow: .25em 0 0 rgba(0,0,0,0), .5em 0 0 rgba(0,0,0,0); 
    }
    40% { 
        color: var(--text-muted); 
        text-shadow: .25em 0 0 rgba(0,0,0,0), .5em 0 0 rgba(0,0,0,0); 
    }
    60% { 
        text-shadow: .25em 0 0 var(--text-muted), .5em 0 0 rgba(0,0,0,0); 
    }
    80%, 100% { 
        text-shadow: .25em 0 0 var(--text-muted), .5em 0 0 var(--text-muted); 
    }
}

/* Test Email Modal */
#acm-test-email-modal .acm-modal-body {
    padding: 20px;
}

#acm-test-email-result {
    min-height: 50px;
}

.acm-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 12px;
    border-radius: 4px;
    margin: 10px 0;
}

.acm-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 12px;
    border-radius: 4px;
    margin: 10px 0;
}

/* New Reminder System Styles */
.acm-reminder-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 15px;
    background: var(--bg-light);
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.acm-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-white);
    border-radius: 6px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.acm-checkbox-label:hover {
    background: #e3f2fd;
    border-color: #2196f3;
}

.acm-checkbox-label input[type="checkbox"] {
    margin: 0;
}

#reminder_select_all {
    font-weight: bold;
    color: #2c5aa0;
}

/* Case Display Styles */
.acm-case-reminders {
    display: flex;
    gap: 5px;
    margin-top: 5px;
    flex-wrap: wrap;
}

.reminder-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    background: #e3f2fd;
    color: #1976d2;
    border: 1px solid #bbdefb;
}

.reminder-badge.active {
    background: var(--success-color);
    color: var(--bg-white);
    border-color: var(--success-color);
}

.acm-case-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin: 10px 0;
}

.acm-case-info-item {
    padding: 8px;
    background: var(--bg-light);
    border-radius: 4px;
    border-left: 3px solid #2c5aa0;
}

.acm-case-info-label {
    font-weight: bold;
    color: #2c5aa0;
    font-size: 12px;
}

.acm-case-info-value {
    font-size: 13px;
    color: #333;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .acm-wrapper {
        padding: 15px;
    }
    
    .acm-case-info-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}

@media (max-width: 768px) {
    .acm-wrapper {
        padding: 10px;
    }
    
    .acm-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        padding: 15px;
    }
    
    .acm-actions {
        width: 100%;
        justify-content: center;
    }
    
    .acm-form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .acm-calendar-date {
        min-height: 100px;
        padding: 4px;
    }
    
    .date-number {
        width: 24px;
        height: 24px;
        line-height: 24px;
        font-size: 12px;
    }
    
    .case-info {
        font-size: 9px;
        padding: 2px 3px;
    }
    
    .acm-modal-content {
        width: 95%;
        margin: 10px;
    }
    
    .acm-form-actions {
        flex-direction: column;
    }
    
    .acm-btn {
        width: 100%;
        margin-bottom: 5px;
    }
    
    .acm-case-info-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .acm-calendar-date {
        min-height: 80px;
    }
    
    .acm-calendar-week {
        min-height: 80px;
    }
    
    .cases-container {
        max-height: 60px;
    }
    
    .acm-brand h2 {
        font-size: 20px;
    }
    
    .acm-brand p {
        font-size: 12px;
    }
    
    .acm-modal-content {
        width: 100%;
        margin: 5px;
        border-radius: var(--border-radius);
    }
}

/* Print styles for case history */
@media print {
    .acm-header,
    .acm-actions,
    .acm-calendar-container,
    .acm-modal,
    .no-print {
        display: none !important;
    }
    
    .acm-wrapper {
        padding: 0;
        margin: 0;
        background: white;
        font-size: 12pt;
        line-height: 1.4;
    }
    
    * {
        color: #000 !important;
        background: #fff !important;
    }
    
    .acm-form-section {
        border: 1px solid #000 !important;
        break-inside: avoid;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .acm-btn-warning {
        background: #ff8c00;
        color: #000;
    }
    
    .acm-calendar-date.today {
        border: 3px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .acm-btn,
    .acm-calendar-date,
    .case-info,
    .acm-close,
    .acm-form-input,
    .acm-history-item,
    .acm-checkbox-label {
        transition: none;
    }
    
    .acm-modal-content {
        animation: none;
    }
    
    .acm-toast {
        animation: none;
    }
    
    .acm-loading:after {
        animation: none;
        content: '';
    }
}