/* Part 97 Amateur Radio Expert - Ham Radio Themed CSS */

:root {
    --ham-orange: #ff6b35;
    --ham-blue: #1e3d59;
    --ham-green: #2ecc71;
    --ham-gray: #34495e;
    --ham-light-gray: #ecf0f1;
    --ham-dark-gray: #2c3e50;
    --background: #f5f7fa;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --border-color: #bdc3c7;
    --shadow-light: rgba(0, 0, 0, 0.1);
    --shadow-medium: rgba(0, 0, 0, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--background) 0%, #e8ecf0 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 20px 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    background: linear-gradient(135deg, var(--ham-blue) 0%, var(--ham-dark-gray) 100%);
    color: white;
    padding: 0.5rem;
    border-radius: 15px 15px 0 0;
    text-align: center;
    box-shadow: 0 4px 20px var(--shadow-medium);
    margin-bottom: 0;
}

.header h1 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.125rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    font-size: 0.8rem;
    opacity: 0.9;
    font-weight: 300;
}

.chat-container {
    background: white;
    border-radius: 0 0 15px 15px;
    box-shadow: 0 4px 20px var(--shadow-medium);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    margin-bottom: 0;
}

.chat-messages {
    flex-grow: 1;
    padding: 1.5rem 1.5rem 120px;
    overflow-y: auto;
    border-bottom: none;
}

.message {
    margin-bottom: 1.5rem;
    animation: fadeInUp 0.3s ease-out;
}

.message-content {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    max-width: 85%;
    box-shadow: 0 2px 10px var(--shadow-light);
}

.user-message .message-content {
    background: linear-gradient(135deg, var(--ham-orange) 0%, #e74c3c 100%);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.assistant-message .message-content {
    background: linear-gradient(135deg, var(--ham-light-gray) 0%, #ffffff 100%);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
}

.assistant-message .message-content strong {
    color: var(--ham-blue);
}

/* Markdown styling for assistant messages */
.assistant-message h2,
.assistant-message h3,
.assistant-message h4 {
    margin: 1rem 0 0.5rem 0;
    font-weight: 600;
    color: var(--ham-blue);
}

.assistant-message h2 {
    font-size: 1.3rem;
}

.assistant-message h3 {
    font-size: 1.15rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.25rem;
}

.assistant-message h4 {
    font-size: 1.05rem;
}

.assistant-message ul,
.assistant-message ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.assistant-message li {
    margin: 0.25rem 0;
}

.assistant-message p {
    margin: 0.5rem 0;
}

.assistant-message p:first-child {
    margin-top: 0;
}

.assistant-message p:last-child {
    margin-bottom: 0;
}

.assistant-message code {
    background: var(--ham-light-gray);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--ham-orange);
}

.callsign-info {
    background: linear-gradient(135deg, #e8f5e8 0%, #f0f8f0 100%);
    border: 1px solid var(--ham-green);
    border-radius: 8px;
    padding: 0.75rem;
    margin: 0.5rem 0;
    font-size: 0.9rem;
}

.callsign-info h4 {
    color: var(--ham-green);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.callsign-details {
    display: grid;
    gap: 0.25rem;
}

.callsign-detail {
    display: flex;
    justify-content: space-between;
}

.callsign-detail strong {
    color: var(--ham-dark-gray);
}

.input-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem 20px;
    background: var(--ham-light-gray);
    border-top: 2px solid var(--border-color);
    box-shadow: 0 -4px 20px var(--shadow-medium);
    z-index: 100;
    max-width: 1400px;
    margin: 0 auto;
}

.input-wrapper {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

#messageInput {
    flex-grow: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    height: 48px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background: white;
}

#messageInput:focus {
    outline: none;
    border-color: var(--ham-orange);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

#sendButton {
    background: linear-gradient(135deg, var(--ham-orange) 0%, #e74c3c 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    height: fit-content;
    box-shadow: 0 2px 8px var(--shadow-light);
}

#sendButton:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--shadow-medium);
}

#sendButton:active {
    transform: translateY(0);
}

#sendButton:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.clear-button {
    background: transparent;
    color: var(--ham-blue);
    border: 1px solid var(--ham-blue);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.clear-button:hover {
    background: var(--ham-blue);
    color: white;
}

.footer-text a {
    color: var(--ham-orange);
    text-decoration: none;
}

.footer-text a:hover {
    text-decoration: underline;
}

.loading-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 8px 30px var(--shadow-medium);
    display: flex;
    align-items: center;
    gap: 1rem;
    font-weight: 500;
    color: var(--ham-blue);
    z-index: 1000;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--ham-light-gray);
    border-top: 3px solid var(--ham-orange);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Enhanced message styling */
.message-content ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.message-content li {
    margin-bottom: 0.25rem;
}

.message-content em {
    color: var(--text-secondary);
    font-style: italic;
}

.message-content code {
    background: rgba(0,0,0,0.1);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

/* Status indicators */
.status-active {
    color: var(--ham-green);
    font-weight: 600;
}

.status-expired {
    color: #e74c3c;
    font-weight: 600;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .message-content {
        max-width: 95%;
    }
    
    .input-wrapper {
        flex-direction: column;
        align-items: stretch;
    }
    
    #sendButton {
        margin-top: 0.5rem;
    }
    
    .input-footer {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
    
    .chat-messages {
        max-height: calc(100vh - 500px);
    }
}

@media (max-width: 480px) {
    .header {
        padding: 1.5rem;
    }
    
    .header h1 {
        font-size: 1.8rem;
    }
    
    .input-container {
        padding: 1rem;
    }
    
    #messageInput {
        min-height: 50px;
    }
}

/* Print styles */
@media print {
    .input-container,
    .loading-indicator {
        display: none;
    }
    
    .chat-container {
        box-shadow: none;
        border: 1px solid var(--border-color);
    }
}