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

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

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

header {
    background: linear-gradient(135deg, #0077BE 0%, #004B87 100%);
    color: white;
    padding: 2rem 0;
    text-align: center;
    margin-bottom: 2rem;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 119, 190, 0.2);
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 20"><path d="M0,10 Q25,0 50,10 T100,10 V20 H0 Z" fill="rgba(0,164,230,0.1)"/></svg>') repeat-x;
    background-size: 200px 40px;
}

.header-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.header-text h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(45deg, #ffffff, #E8F4FD);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

.header-text p {
    font-size: 1.1rem;
    opacity: 0.95;
    color: #E8F4FD;
}

.polimatia-badge {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-top: 0.5rem;
}

.status-card {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 8px 25px rgba(0, 119, 190, 0.1);
    border-left: 5px solid #00A4E6;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: rgba(255, 255, 255, 0.9);
    padding: 1.5rem;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 8px 25px rgba(0, 119, 190, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 35px rgba(0, 119, 190, 0.15);
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    background: linear-gradient(45deg, #0077BE, #00A4E6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: #004B87;
    font-size: 0.9rem;
    font-weight: 500;
}

.summaries-section {
    margin-top: 2rem;
}

.summary-card {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 25px rgba(0, 119, 190, 0.1);
    border-left: 5px solid #0077BE;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.summary-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

.summary-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: #333;
}

.summary-meta {
    color: #666;
    font-size: 0.9rem;
}

.summary-content {
    white-space: pre-wrap;
    line-height: 1.6;
    font-size: 0.9rem;
    max-height: 400px;
    overflow-y: auto;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 5px;
    border: 1px solid #e9ecef;
}

.loading {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.error {
    background: #ffebee;
    color: #c62828;
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 1rem;
    border-left: 4px solid #c62828;
}

.refresh-button {
    background: linear-gradient(45deg, #0077BE, #00A4E6);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 119, 190, 0.3);
}

.refresh-button:hover {
    background: linear-gradient(45deg, #004B87, #0077BE);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 119, 190, 0.4);
}

.refresh-button:active {
    transform: translateY(0);
}

.last-updated {
    text-align: center;
    color: #666;
    font-size: 0.9rem;
    margin-top: 1rem;
}

/* Tab styles */
.tabs-container {
    margin-bottom: 2rem;
}

.tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 119, 190, 0.1);
    overflow: hidden;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.tab-button {
    flex: 1;
    padding: 1rem 2rem;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border-right: 1px solid rgba(0, 119, 190, 0.1);
    color: #004B87;
    position: relative;
}

.tab-button:last-child {
    border-right: none;
}

.tab-button:hover {
    background: rgba(0, 164, 230, 0.1);
    color: #0077BE;
}

.tab-button.active {
    background: linear-gradient(45deg, #0077BE, #00A4E6);
    color: white;
}

.tab-button.active::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(45deg, #E8F4FD, white);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Analytics styles */
.analytics-section {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 8px 25px rgba(0, 119, 190, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.analytics-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: rgba(232, 244, 253, 0.5);
    border-radius: 12px;
    border: 1px solid rgba(0, 164, 230, 0.1);
}

.analytics-controls label {
    font-weight: 600;
    color: #004B87;
}

.analytics-controls select {
    padding: 0.5rem 1rem;
    border: 2px solid rgba(0, 119, 190, 0.2);
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    color: #004B87;
    transition: border-color 0.3s ease;
}

.analytics-controls select:focus {
    outline: none;
    border-color: #0077BE;
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.analytics-card {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 164, 230, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 119, 190, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.analytics-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 119, 190, 0.1);
}

.analytics-card h3 {
    background: linear-gradient(45deg, #0077BE, #00A4E6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.metric-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.metric-item:last-child {
    border-bottom: none;
}

.metric-label {
    color: #666;
}

.metric-value {
    font-weight: bold;
    color: #333;
}

/* Conversations tab styles */
.conversations-section {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 8px 25px rgba(0, 119, 190, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Summaries controls - same style as conversations controls */
.summaries-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem;
    background: rgba(232, 244, 253, 0.5);
    border-radius: 12px;
    border: 1px solid rgba(0, 164, 230, 0.1);
    flex-wrap: wrap;
    gap: 1rem;
}

.summary-stats {
    display: flex;
    gap: 2rem;
}

.conversations-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem;
    background: rgba(232, 244, 253, 0.5);
    border-radius: 12px;
    border: 1px solid rgba(0, 164, 230, 0.1);
    flex-wrap: wrap;
    gap: 1rem;
}

.date-selector {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.date-selector label {
    font-weight: bold;
    color: #333;
}

.date-selector select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    min-width: 150px;
}

.date-info {
    color: #666;
    font-size: 0.9rem;
}

.conversation-stats {
    display: flex;
    gap: 2rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.stat-item .stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    background: linear-gradient(45deg, #0077BE, #00A4E6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-item .stat-label {
    font-size: 0.9rem;
    color: #004B87;
    font-weight: 500;
}

.conversation-card {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 164, 230, 0.1);
    border-radius: 12px;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 119, 190, 0.05);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.conversation-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 119, 190, 0.1);
}

.conversation-header {
    background: linear-gradient(45deg, #0077BE, #00A4E6);
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background 0.3s ease;
}

.conversation-header:hover {
    background: linear-gradient(45deg, #004B87, #0077BE);
}

.conversation-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.conversation-meta {
    font-size: 0.9rem;
    opacity: 0.9;
}

.conversation-content {
    display: none;
    max-height: 400px;
    overflow-y: auto;
    padding: 0;
}

.conversation-content.expanded {
    display: block;
}

.message {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.message:last-child {
    border-bottom: none;
}

.message.user {
    background: #f8f9fa;
}

.message.assistant {
    background: rgba(232, 244, 253, 0.3);
}

.message-role {
    font-weight: 600;
    min-width: 80px;
    font-size: 0.9rem;
}

.message.user .message-role {
    color: #004B87;
}

.message.assistant .message-role {
    background: linear-gradient(45deg, #0077BE, #00A4E6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.message-content {
    flex: 1;
    word-wrap: break-word;
    line-height: 1.4;
}

.message-time {
    font-size: 0.8rem;
    color: #666;
    min-width: 120px;
    text-align: right;
}

.conversation-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.2rem;
    border-radius: 3px;
}

.conversation-toggle:hover {
    background: rgba(255,255,255,0.2);
}

/* Loading and success states for summary generation */
.loading-generation {
    text-align: center;
    padding: 3rem 2rem;
    background: rgba(232, 244, 253, 0.5);
    border-radius: 12px;
    margin: 2rem 0;
}

.loading-generation h3 {
    color: #0077BE;
    margin: 1rem 0;
    font-size: 1.5rem;
}

.loading-generation p {
    color: #004B87;
    margin: 0.5rem 0;
}

.loading-detail {
    font-size: 0.9rem;
    color: #666;
    font-style: italic;
}

.spinner {
    border: 4px solid rgba(0, 119, 190, 0.1);
    border-top: 4px solid #0077BE;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem auto;
}

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

.success-message {
    text-align: center;
    padding: 2rem;
    background: rgba(76, 175, 80, 0.1);
    border: 2px solid rgba(76, 175, 80, 0.3);
    border-radius: 12px;
    margin: 2rem 0;
}

.success-message h3 {
    color: #4CAF50;
    margin: 0.5rem 0;
}

.success-message p {
    color: #2E7D32;
    margin: 0.3rem 0;
}

.retry-button {
    margin-top: 1rem;
    padding: 0.8rem 1.5rem;
    background: linear-gradient(45deg, #0077BE, #00A4E6);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.retry-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 119, 190, 0.3);
}

/* Additional swimming-themed elements */
.wave-decoration {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: linear-gradient(45deg, rgba(0, 119, 190, 0.1), rgba(0, 164, 230, 0.05));
    z-index: -1;
}

.wave-decoration::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 200%;
    height: 100%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 20"><path d="M0,10 Q25,0 50,10 T100,10 L100,20 L0,20 Z" fill="rgba(0,164,230,0.1)"/></svg>') repeat-x;
    background-size: 100px 20px;
    animation: wave 10s linear infinite;
}

@keyframes wave {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* Enhanced mobile responsiveness */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    .header-text h1 {
        font-size: 2rem;
    }

    .logo {
        width: 60px;
        height: 60px;
    }

    .status-grid {
        grid-template-columns: 1fr;
    }

    .analytics-grid {
        grid-template-columns: 1fr;
    }

    .summaries-controls,
    .conversations-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .summary-stats,
    .conversation-stats {
        justify-content: space-around;
    }

    .tab-button {
        padding: 0.8rem 1rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .header-text h1 {
        font-size: 1.8rem;
    }

    .tab-button {
        padding: 0.7rem 0.8rem;
        font-size: 0.8rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-number {
        font-size: 1.8rem;
    }
}