/* Additional styles for Bylaw Compliance Reviewer */
/* Base button styles that both buttons will share */
.primary-button, .print-button {
    /* Layout */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    
    /* Visual styling */
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    
    /* Modern border effect */
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Individual button colors */
.primary-button {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
}

.print-button {
    background: transparent;
    color: white;
}

/* Icon styling for both buttons */
.primary-button i, .print-button i {
    font-size: 16px;
    transition: transform 0.3s ease;
}

/* Hover effects for both */
.primary-button:hover, .print-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.primary-button:hover i, .print-button:hover i {
    transform: scale(1.1);
}

/* Active state for both */
.primary-button:active, .print-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Ripple effect for both */
.primary-button::after, .print-button::after {
    content: "";
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 1%, transparent 1%) center/15000%;
    opacity: 0;
    transition: opacity 0.5s, background-size 0.5s;
}

.primary-button:active::after, .print-button:active::after {
    background-size: 100%;
    opacity: 1;
    transition: 0s;
}

/* Focus states */
.primary-button:focus-visible, .print-button:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* Shine effect for both */
.primary-button::before, .print-button::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        to bottom right,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0) 30%,
        rgba(255, 255, 255, 0.3) 45%,
        rgba(255, 255, 255, 0) 60%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: rotate(30deg);
    transition: all 0.3s ease;
    opacity: 0;
}

.primary-button:hover::before, .print-button:hover::before {
    opacity: 1;
    left: 100%;
    top: 100%;
}

/* Specific shadow colors on hover */
.primary-button:hover {
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.print-button:hover {
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4);
}

.small-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 6px 12px;
    background: none; /* Remove background */
    border: none; /* Optional: remove border */
    color: var(--text-secondary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 4px;
}


.small-button {
    padding: 6px 12px;
    font-size: 0.75rem;
    min-height: 10px;
    border-radius: 10px;
}

.small-button:hover,
.small-button:focus {
    color: white;
    background-color: rgba(255, 255, 255, 0.1); /* Soft hover background */
    outline: none;
}

.small-button .icon-modern {
    font-size: 1.1rem;
}

.results-panel {
    background-color: var(--bg-elevated);
    border-radius: 12px;
    padding: 20px;
    margin-top: 16px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 12px;
}

.results-header h3 {
    font-size: 1.1rem;
    color: var(--text);
}

.results-content {
    min-height: 200px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 2rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(59, 130, 246, 0.2);
    border-radius: 50%;
    border-top-color: var(--accent);
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--error);
    text-align: center;
}

.error-state i {
    font-size: 2rem;
    margin-bottom: 16px;
}

.compliance-report {
    background-color: #f9f9f9; /* Light background */
    color: #000; /* Black text */
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    margin-top: 16px;
    line-height: 1.6;
    font-size: 0.95rem;
    border: 1px solid #ddd; /* Optional subtle border */
}

.compliance-report h4 {
    color: #000;
    font-weight: 600;
    margin-bottom: 16px;
    font-size: 1.1rem;
}

.compliance-report p {
    margin-bottom: 12px;
}

.empty-state {
    background-color: #f5f5f5;
    color: #000;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    font-style: italic;
}

.report-content {
    text-align: left !important;
}

.report-content p {
    text-align: left;
    margin-left: 0;
    padding-left: 0;
}

.chat-container.hidden {
    display: none;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
}

.chat-header h3 {
    font-size: 1rem;
    color: var(--text);
}

#chat-close {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 4px;
    margin-left: 8px;
}

#chat-close:hover {
    color: var(--error);
}


.message {
	text-align: left;
    max-width: 80%;
    padding: 12px 16px;
    margin-bottom: 8px;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.5;
    animation: fadeIn 0.3s ease;
}

.user-message {
    text-align: left;
    margin-left: auto;
    background-color: var(--accent);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.ai-message {
    text-align: left;
    margin-right: auto;	
    background-color: var(--primary-light);
    color: var(--text);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-bottom: 4px;
}

.typing {
    opacity: 0.8;
}

.typing-dots span {
    display: inline-block;
    animation: typingDots 1.4s infinite;
    opacity: 0.2;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingDots {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 1; }
}

.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
}

.alert.error {
    background-color: rgba(239, 68, 68, 0.2);
    border-left: 4px solid var(--error);
    color: var(--error);
}

.alert.success {
    background-color: rgba(16, 185, 129, 0.2);
    border-left: 4px solid var(--success);
    color: var(--success);
}

.fade-out {
    opacity: 0;
    transition: opacity 0.3s ease;
}

@media (max-width: 768px) {
    .results-panel {
        padding: 16px;
    }
    
    .compliance-report {
        padding: 12px;
    }
    
    .message {
        max-width: 90%;
        padding: 10px 14px;
    }
}

.bottom-anchor {
    overflow-anchor: auto;
    height: 1px;
}

.hidden {
    display: none !important;
}

/* Update chat button styles */
#show-chat {
    background-color: var(--primary-light);
    color: var(--text);
    border: none;
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

#show-chat:hover {
    background-color: var(--accent);
    color: white;
}

/* Make chat container slide up from bottom */
.chat-container {
    height: calc(100vh - var(--nav-height) - 120px);
    min-height: 400px;
    width: 100%;
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: linear-gradient(135deg, #1e293b, #334155); /* Soft gradient */
}

.chat-container:not(.hidden) {
    transform: translateY(0);
    opacity: 1;
}

@media (max-width: 768px) {
    .chat-container {
        width: calc(100% - 48px);
        right: 12px;
        left: 12px;
        bottom: 70px;
        max-height: 50vh;
    }
}

.menu-backdrop {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
}

.menu-backdrop.active {
    display: block;
}

@media print {
    /* Hide unnecessary elements */
    .navbar, .sidebar, .input-area, .chat-container, .settings-panel, .results-header .small-button:last-child {
        display: none !important;
    }

    /* Ensure the report content fills the page */
    body {
        background-color: white;
        color: black;
        margin: 0;
        padding: 0;
    }

    /* Reset layout for printing */
    .main-container, .main-content, .results-panel {
        width: 100%;
        margin: 0;
        padding: 0;
    }

    .compliance-report {
        box-shadow: none;
        border: none;
        padding: 1rem;
    }

    h3, h4 {
        page-break-after: avoid;
    }

    p, li {
        orphans: 2;
        widows: 2;
    }

    pre, code {
        page-break-inside: avoid;
        white-space: pre-wrap;
    }
}

.button-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: 16px;
}

/* Hide native file input but keep it functional */
.file-input-native {
    display: none;
}

/* Style custom upload button */
.file-upload-button {
    /* Layout */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    
    /* Sizing */
    height: 24px; /* Fixed height */
    padding: 0 12px; /* Horizontal padding only */
    min-width: fit-content;
    
    /* Text */
    font-size: 0.70rem;
    line-height: 1;
    white-space: nowrap;
    
    /* Visual styling */
    border-radius: 12px;
    border: none;
    background-color: var(--accent);
    color: white;
    cursor: pointer;
    
    /* Effects */
    transition: all 0.3s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    
    /* Prevent text overflow */
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Icon sizing */
.file-upload-button i.fas {
    font-size: 0.65rem; /* Slightly smaller icon */
    margin: 0; /* Remove any default margins */
    line-height: 1;
    display: inline-flex;
    align-items: center;
}

/* Hover state */
.file-upload-button:hover {
    background-color: var(--accent-light);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

/* Active state */
.file-upload-button:active {
    transform: translateY(0);
    box-shadow: none;
}

/* Focus state for accessibility */
.file-upload-button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

/* Typewriter effect styles */
@keyframes typing {
  from { width: 0 }
  to { width: 100% }
}

@keyframes blink-caret {
  from, to { border-color: transparent }
  50% { border-color: teal }
}

.typewriter {
  overflow: hidden;
  border-right: 2px solid teal;
  white-space: pre-wrap;
  margin: 0;
  padding: 0;
  display: inline-block;
}

.typing-animation {
  animation: 
    typing 0.05s steps(40, end),
    blink-caret 0.75s step-end infinite;
}

/* Chat container scroll behavior */
.chat-messages {
  overflow-y: auto;
  scroll-behavior: smooth;
  will-change: transform;
}

/* Typing indicator styles */
.typing-indicator {
    display: flex;
    padding: 5px 0;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    background-color: teal;
    border-radius: 50%;
    display: inline-block;
    margin: 0 2px;
    opacity: 0.4;
}

.typing-indicator span:nth-child(1) {
    animation: pulse 1s infinite;
}

.typing-indicator span:nth-child(2) {
    animation: pulse 1s infinite 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation: pulse 1s infinite 0.4s;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.4;
        transform: scale(0.9);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}