/* Auto-Answer Time Widget Styles - Top of Post Display */

#auto-answer-widget {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 12px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    margin-top: 0;
}

.widget-header {
    margin-bottom: 20px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 15px;
}

.widget-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.4;
    color: white;
    text-align: center;
}

#answer-result {
    background: rgba(255, 255, 255, 0.15);
    padding: 25px;
    border-radius: 8px;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    backdrop-filter: blur(10px);
}

/* Loading state */
.loading {
    text-align: center;
    font-size: 16px;
    color: rgba(255, 255, 255, 0.8);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Answer display styles */
.answer-main {
    font-size: 42px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 15px;
    line-height: 1.2;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Live clock animation */
.answer-main.live-clock {
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
}

.answer-main.live-clock strong {
    display: inline-block;
    transition: none; /* Disable transitions for smooth counting */
}

/* Smooth updates - prevent flash */
.answer-sub .military-time,
.answer-sub .regular-time {
    display: inline;
    transition: none;
}

/* Prevent entire content from flashing */
#answer-result {
    will-change: contents;
}

#answer-result > div {
    animation: none; /* Disable fade-in after initial load */
}

/* Only animate on first load */
#answer-result.first-load > div {
    animation: fadeIn 0.5s ease-out;
}

#answer-result.first-load {
    /* This class is removed after first update */
}

.answer-sub {
    font-size: 18px;
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 10px;
}

.answer-location {
    font-size: 16px;
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 8px;
    font-style: italic;
}

.answer-date {
    font-size: 14px;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 8px;
}

/* Tablet responsive styles */
@media (max-width: 1024px) {
    #auto-answer-widget {
        padding: 20px;
    }
    
    .widget-title {
        font-size: 18px;
    }
    
    .answer-main {
        font-size: 36px;
    }
    
    .answer-sub {
        font-size: 16px;
    }
}

/* Mobile responsive styles */
@media (max-width: 768px) {
    #auto-answer-widget {
        padding: 20px;
        border-radius: 10px;
        margin-bottom: 25px;
    }
    
    .widget-title {
        font-size: 16px;
    }
    
    #answer-result {
        padding: 20px;
        min-height: 80px;
    }
    
    .answer-main {
        font-size: 32px;
    }
    
    .answer-sub {
        font-size: 15px;
    }
    
    .answer-location {
        font-size: 14px;
    }
    
    .answer-date {
        font-size: 13px;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    #auto-answer-widget {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .widget-title {
        font-size: 14px;
    }
    
    #answer-result {
        padding: 15px;
    }
    
    .answer-main {
        font-size: 28px;
    }
    
    .answer-sub {
        font-size: 14px;
    }
    
    .answer-location {
        font-size: 13px;
    }
    
    .answer-date {
        font-size: 12px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    #auto-answer-widget {
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    }
}

/* Print styles */
@media print {
    #auto-answer-widget {
        background: white;
        color: black;
        border: 2px solid #667eea;
        page-break-inside: avoid;
    }
    
    .answer-main,
    .answer-sub,
    .answer-location,
    .answer-date {
        color: black;
    }
}

/* Accessibility improvements */
#auto-answer-widget:focus-within {
    outline: 3px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* Animation for answer appearing */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#answer-result > div {
    animation: fadeIn 0.5s ease-out;
}

/* Error state */
.error-message {
    color: #ffcccc;
    text-align: center;
    font-size: 15px;
    padding: 10px;
}

/* Success state */
.success-message {
    color: #ccffcc;
    text-align: center;
    font-size: 15px;
    padding: 10px;
}

/* Ensure widget appears above post content */
.entry-content #auto-answer-widget:first-child {
    margin-top: 0;
}

/* Integration with common WordPress themes */
.post-content #auto-answer-widget,
.article-content #auto-answer-widget,
.content #auto-answer-widget {
    margin-top: 0;
    margin-bottom: 30px;
}

/* Full width on narrow containers */
@media (max-width: 768px) {
    #auto-answer-widget {
        margin-left: -15px;
        margin-right: -15px;
        border-radius: 0;
        width: calc(100% + 30px);
    }
}