/* Custom styles for eAG/A1C Calculator */

/* ===================================
   Toast Notifications
   =================================== */

.toast {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background-color: #1f2937;
    color: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 0.875rem;
    pointer-events: auto;
    animation: toastSlideUp 0.3s ease-out;
}

.toast-success {
    background-color: #059669;
}

.toast-error {
    background-color: #dc2626;
}

.toast svg {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

@keyframes toastSlideUp {
    from {
        opacity: 0;
        transform: translateY(1rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastFadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

.toast.fade-out {
    animation: toastFadeOut 0.3s ease-out forwards;
}

/* Base styles */
body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.5;
    color: #333333;
}

/* Custom form elements */
.form-radio {
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid #cbd5e0;
    border-radius: 50%;
    outline: none;
    transition: all 0.2s ease-in-out;
}

.form-radio:checked {
    border-color: #3498db;
    background-color: #3498db;
    background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='4'/%3e%3c/svg%3e");
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
}

/* Accordion styles */
.accordion-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.5);
}

.accordion-btn.active svg {
    transform: rotate(180deg);
}

/* Custom focus styles for better accessibility */
input:focus, 
button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.5);
}

/* Custom transitions */
.transition-transform {
    transition: transform 0.2s ease-in-out;
}

/* Custom animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

/* Result container highlight */
.result-highlight {
    background-color: #ebf8ff;
    border-color: #90cdf4;
    transition: all 0.3s ease-in-out;
}

/* Error container styles */
#error-container {
    animation: fadeIn 0.3s ease-in-out;
}

/* Tooltip styles */
.tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
}

.tooltip .tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
}

.tooltip .tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .tooltip .tooltip-text {
        width: 160px;
        margin-left: -80px;
    }
}

/* ===================================
   Mobile Navigation Styles
   =================================== */

#mobile-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

#mobile-menu.show {
    max-height: 200px;
}

#mobile-menu-btn .menu-icon,
#mobile-menu-btn .close-icon {
    transition: opacity 0.2s ease;
}

#mobile-menu-btn.active .menu-icon {
    display: none;
}

#mobile-menu-btn.active .close-icon {
    display: block;
}

#mobile-menu-btn .close-icon {
    display: none;
}

/* Improve tap targets on mobile */
@media (max-width: 767px) {
    #mobile-menu a {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }
}

/* Print styles */
@media print {
    body {
        background-color: white;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
    
    .accordion-content {
        display: block !important;
    }
    
    .accordion-btn svg {
        display: none;
    }
    
    button, 
    .accordion-btn {
        background-color: transparent !important;
    }
    
    #calculate-btn {
        display: none;
    }
    
    #cookie-consent-banner {
        display: none !important;
    }
}

/* ===================================
   Cookie Consent Banner Styles
   =================================== */

#cookie-consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(17, 24, 39, 0.98);
    color: #f3f4f6;
    padding: 1.5rem;
    z-index: 9999;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    transform: translateY(100%);
    transition: transform 0.4s ease-out;
}

#cookie-consent-banner.show {
    transform: translateY(0);
}

#cookie-consent-banner.hide {
    transform: translateY(100%);
}

.consent-container {
    max-width: 1200px;
    margin: 0 auto;
}

.consent-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.consent-text {
    flex: 1;
}

.consent-text h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #fff;
}

.consent-text p {
    font-size: 0.875rem;
    color: #d1d5db;
    line-height: 1.5;
}

.consent-text a {
    color: #60a5fa;
    text-decoration: underline;
}

.consent-text a:hover {
    color: #93c5fd;
}

/* Consent Buttons */
.consent-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.consent-btn {
    padding: 0.625rem 1.25rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    white-space: nowrap;
}

.consent-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.5);
}

.consent-btn-primary {
    background-color: #3b82f6;
    color: #fff;
}

.consent-btn-primary:hover {
    background-color: #2563eb;
}

.consent-btn-secondary {
    background-color: #4b5563;
    color: #fff;
}

.consent-btn-secondary:hover {
    background-color: #6b7280;
}

.consent-btn-outline {
    background-color: transparent;
    color: #d1d5db;
    border: 1px solid #6b7280;
}

.consent-btn-outline:hover {
    background-color: #374151;
    color: #fff;
}

/* Granular Options */
.consent-options {
    display: none;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #374151;
}

.consent-options.show {
    display: block;
}

.consent-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #374151;
}

.consent-option:last-child {
    border-bottom: none;
}

.consent-option-info {
    flex: 1;
}

.consent-option-info h4 {
    font-size: 0.9375rem;
    font-weight: 500;
    color: #fff;
    margin-bottom: 0.25rem;
}

.consent-option-info p {
    font-size: 0.8125rem;
    color: #9ca3af;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #4b5563;
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: #fff;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #3b82f6;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.5);
}

.toggle-switch input:disabled + .toggle-slider {
    background-color: #6b7280;
    cursor: not-allowed;
}

.toggle-switch input:disabled + .toggle-slider:before {
    background-color: #d1d5db;
}

/* Save Preferences Button */
.consent-save-container {
    display: none;
    margin-top: 1rem;
    text-align: right;
}

.consent-options.show + .consent-save-container,
.consent-save-container.show {
    display: block;
}

/* Responsive Design */
@media (max-width: 768px) {
    #cookie-consent-banner {
        padding: 1rem;
    }
    
    .consent-header {
        flex-direction: column;
    }
    
    .consent-buttons {
        width: 100%;
        justify-content: stretch;
    }
    
    .consent-btn {
        flex: 1;
        text-align: center;
        padding: 0.75rem 1rem;
    }
    
    .consent-option {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .toggle-switch {
        align-self: flex-end;
    }
}
