/* Base Styles */
:root {
    --primary-color: #0062cc;
    --secondary-color: #f8f9fa;
    --text-color: #333;
    --border-color: #e1e1e1;
    --drawer-width: 300px;
    --drawer-collapsed-width: 60px;
    --transition-speed: 0.3s;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-color);
    background-color: #fff;
    line-height: 1.6;
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* Side Drawer */
.controls-drawer {
    width: var(--drawer-width);
    height: 100%;
    background-color: var(--secondary-color);
    border-right: 1px solid var(--border-color);
    transition: width var(--transition-speed) ease;
    overflow-y: auto;
    z-index: 10;
}

.controls-drawer.collapsed {
    width: var(--drawer-collapsed-width);
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.drawer-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

.toggle-drawer {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-color);
    font-size: 1.2rem;
    transition: transform var(--transition-speed);
}

.collapsed .toggle-drawer i {
    transform: rotate(180deg);
}

.drawer-content {
    padding: 1rem;
}

.controls-drawer.collapsed .drawer-content,
.controls-drawer.collapsed .drawer-header h2 {
    display: none;
}

/* Control Groups */
.control-group {
    margin-bottom: 2rem;
}

.control-group h3 {
    margin-bottom: 1rem;
    font-size: 1rem;
    font-weight: 600;
}

.filter {
    margin-bottom: 1.2rem;
}

.filter label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.filter select,
.filter input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
}

.date-inputs {
    display: flex;
    gap: 0.5rem;
}

.date-inputs input {
    width: 50%;
}

/* Buttons */
.primary-button {
    width: 100%;
    padding: 0.8rem 1rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s;
}

.primary-button:hover {
    background-color: #0056b3;
}

/* Content Area */
.content-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: margin-left var(--transition-speed) ease;
}

/* Artwork Container */
.artwork-container {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

.artwork-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.artwork-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #aaa;
    padding: 2rem;
}

.artwork-placeholder i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Artwork Info */
.artwork-info {
    padding: 1rem;
    background-color: rgba(255, 255, 255, 0.9);
    border-top: 1px solid var(--border-color);
}

.artwork-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.artwork-artist,
.artwork-date,
.artwork-medium {
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
}

.artwork-department {
    font-size: 0.8rem;
    color: #666;
}

/* Loading State */
.loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5;
}

.loading-spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

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

/* Responsive */
@media (max-width: 768px) {
    .controls-drawer {
        position: absolute;
        height: 100%;
        transform: translateX(0);
        transition: transform var(--transition-speed) ease;
    }
    
    .controls-drawer.collapsed {
        transform: translateX(calc(-1 * var(--drawer-width) + var(--drawer-collapsed-width)));
    }
    
    .content-area {
        margin-left: var(--drawer-collapsed-width);
    }
}


/* Error styling for inputs */
.filter input.error {
    border-color: #dc3545;
    background-color: rgba(220, 53, 69, 0.1);
}

/* Tooltip for date ranges */
.date-tooltip {
    font-size: 0.75rem;
    color: #666;
    margin-top: 0.25rem;
}

/* Add to your existing styles.css file */

/* Error message */
.error-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #dc3545;
    padding: 2rem;
    font-size: 1.2rem;
}

/* Artwork image */
.artwork-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

/* Link styling */
.artwork-link a {
    color: var(--primary-color);
    text-decoration: none;
}

.artwork-link a:hover {
    text-decoration: underline;
}
/* Connection status indicator */
.connection-status {
    position: fixed;
    top: 10px;
    right: 10px;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    z-index: 1000;
    transition: opacity 0.5s ease;
}

.connection-status.connected {
    background-color: #28a745;
    color: white;
}

.connection-status.disconnected {
    background-color: #dc3545;
    color: white;
}

/* Enhanced loading state */
.loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 5;
}

.loading-spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

.loading-text {
    font-size: 1rem;
    color: var(--text-color);
}

/* Improved error message */
.error-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #dc3545;
    padding: 2rem;
}

.error-message p {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
}

.retry-button {
    padding: 0.5rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s;
    margin-bottom: 1rem;
}

.retry-button:hover {
    background-color: #0056b3;
}

.retry-button.no-filters {
    background-color: #6c757d;
    margin-bottom: 0;
}

.retry-button.no-filters:hover {
    background-color: #5a6268;
}

/* Status indicator */
.status-indicator {
    position: fixed;
    bottom: 15px;
    left: 15px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    padding: 8px 15px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    font-size: 0.8rem;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.status-indicator .status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-indicator.info .status-dot {
    background-color: #17a2b8;
}

.status-indicator.loading .status-dot {
    background-color: #ffc107;
    animation: pulse 1.5s infinite;
}

.status-indicator.error .status-dot {
    background-color: #dc3545;
}

.status-indicator.success .status-dot {
    background-color: #28a745;
}

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

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

/* Better mobile responsiveness for artwork display */
@media (max-width: 768px) {
    .artwork-container {
        padding: 1rem;
    }
    
    .artwork-info {
        padding: 0.8rem;
    }
    
    .artwork-title {
        font-size: 1.2rem;
    }
    
    .status-indicator {
        bottom: 10px;
        left: 10px;
        padding: 5px 10px;
        font-size: 0.7rem;
    }
}

/* Add a little padding to the artwork container */
.artwork-container {
    padding: 1rem;
}

/* Make the artwork image more responsive */
.artwork-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.artwork-image:hover {
    transform: scale(1.02);
}

/* Image container */
.artwork-image-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 300px;
    position: relative;
}

/* Hidden image (during loading) */
.artwork-image.hidden {
    display: none;
}

/* Enhanced loading spinner for images */
.artwork-image-container .loading-spinner {
    border: 5px solid rgba(0, 0, 0, 0.1);
    border-left-color: var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Image error state */
.artwork-image-container .artwork-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #dc3545;
    padding: 2rem;
}

.artwork-image-container .artwork-placeholder i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Retry button */
.retry-button {
    margin-top: 1rem;
    padding: 0.5rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.retry-button:hover {
    background-color: #0056b3;
}