/* History page specific styles */

.history-section {
    padding: 0;
}

/* History Page Layout */
.page-header h1 {
    margin: 0 0 5px 0;
    /* Color, size, weight, and alignment now handled by common.css */
}

/* History page main content styling */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Reduce content padding for history page */
.main-content .content {
    padding: 20px;
    width: 100%;
}

.desktop-layout {
    display: flex;
    gap: 20px;
    min-height: calc(100vh - 200px);
    width: 100%;
    margin: 0 auto;
    max-width: 1400px;
    justify-content: center;
}

.calendar-section {
    flex: 1;
    max-width: 48%;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    padding: 15px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.preview-section {
    flex: 1;
    max-width: 48%;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    padding: 15px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.preview-header h3 {
    margin: 0 0 15px 0;
    color: #05208e;
    font-size: 1.2em;
    font-weight: 500;
}

.data-sources h4,
.service-info h4 {
    margin: 0 0 15px 0;
    color: #05208e;
    font-size: 1.2em;
    font-weight: 500;
}

.preview-container {
    flex: 1;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    border: 2px solid rgba(0, 123, 255, 0.1);
}

.report-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: none;
}

.preview-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.placeholder-content {
    text-align: center;
    color: #6c757d;
}

.placeholder-content h4 {
    margin: 0 0 10px 0;
    font-size: 1.1em;
}

.placeholder-content p {
    margin: 0;
    font-size: 0.9em;
}

.preview-actions {
    margin-top: 15px;
    text-align: center;
}

.view-report-btn {
    background: #05208e;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.view-report-btn:hover {
    background: #041a73;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(5, 32, 142, 0.3);
}

.mobile-layout {
    display: none;
}

.mobile-layout .calendar-legend {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 5px 0 15px 0;
    padding: 8px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 6px;
    backdrop-filter: blur(10px);
    position: relative;
    width: 100%;
}

/* Calendar Styles */
.calendar-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin: 10px 0 15px 0;
    padding: 8px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.calendar-nav-btn {
    width: 35px;
    height: 35px;
    border: none;
    border-radius: 50%;
    background: #05208e;
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(5, 32, 142, 0.3);
}

.calendar-nav-btn:hover {
    background: #041a73;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(5, 32, 142, 0.4);
}

.calendar-nav-btn:active {
    transform: translateY(0);
}

#currentMonth {
    margin: 0;
    font-size: 1.3em;
    color: #05208e;
    font-weight: 600;
    min-width: 220px;
    text-align: center;
}

.desktop-layout .calendar-container {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 8px 8px 4px 8px;
    margin: 10px 0 0 0;
    overflow: hidden;
}

.mobile-layout .calendar-container {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    margin: 15px 0;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 15px;
    overflow: hidden;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    margin-bottom: 10px;
}

.weekday {
    padding: 6px 4px;
    text-align: center;
    font-weight: 600;
    color: #666;
    background: rgba(0, 123, 255, 0.1);
    border-radius: 4px;
    font-size: 0.9em;
}

.desktop-layout .calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    margin-bottom: 0;
    overflow: hidden;
    /* Adjust height to make room for transcript list */
    min-height: 350px;
}
.mobile-layout .calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    height: auto; /* Auto height based on content */
    max-height: 50vh; /* Maximum height on mobile */
    overflow: hidden;
    position: relative;
    z-index: 1;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.mobile-layout .calendar-day {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 4px;
    transition: all 0.3s ease;
    padding: 5px;
    aspect-ratio: 1/1; /* Make cells square */
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.mobile-layout .calendar-grid {
    height: 250px; /* Reduce overall calendar height */
}

.calendar-day:hover {
    background: rgba(0, 123, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.2);
}

.calendar-day.other-month {
    opacity: 0.3;
    cursor: default;
}

.calendar-day.other-month:hover {
    transform: none;
    box-shadow: none;
    background: rgba(255, 255, 255, 0.7);
}

.calendar-day.today {
    background: rgba(0, 123, 255, 0.2) !important;
    border-color: #007bff !important;
    font-weight: bold;
}

.calendar-day.today.has-reports {
    background: rgba(0, 123, 255, 0.3) !important;
    border-color: #007bff !important;
}

.calendar-day.has-reports {
    background: rgba(40, 167, 69, 0.1);
    border-color: rgba(40, 167, 69, 0.5);
}

.calendar-day.has-reports:hover {
    background: rgba(40, 167, 69, 0.2);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.day-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 2px;
    min-height: 12px;
}

@media (max-width: 480px) {
    .day-header {
        margin-bottom: 0;
        min-height: 0;
    }
}

.day-number {
    font-size: 1.0em;
    font-weight: 600;
    color: #333;
}
.day-reports {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin-top: 2px;
    align-items: center;
    font-size: 0.75em; /* Make text smaller to fit in square cells */
}

@media (max-width: 480px) {
    .day-reports {
        gap: 0;
        margin-top: 0;
        font-size: 0.6em;
    }
}

/* Ensure desktop calendar cells handle multiple reports properly */
.desktop-layout .day-reports {
    gap: 2px;
    padding: 1px 0;
}

.report-link-inline {
    background: #28a745;
    color: white;
    text-decoration: none;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 0.8em;
    font-weight: 500;
    margin: 1px 0;
    display: block;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.transcript-count {
    background: #28a745;
    color: white;
    text-decoration: none;
    padding: 3px 4px;
    border-radius: 3px;
    font-size: 0.75em;
    font-weight: 500;
    margin: 1px 0;
    display: block;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 90%; /* Make sure it fits within the cell */
}

@media (max-width: 480px) {
    .transcript-count {
        font-size: 0.55em;
        padding: 1px;
        margin: 0;
    }
}

.report-link-inline:hover {
    background: #218838;
    transform: scale(1.05);
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
}

.no-reports-text {
    font-size: 0.8em;
    color: #666;
    text-align: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8em;
    color: #666;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    border: 1px solid transparent;
}

.legend-color.today {
    background: rgba(0, 123, 255, 0.2);
    border-color: #007bff;
}

.legend-color.has-reports {
    background: rgba(40, 167, 69, 0.1);
    border-color: rgba(40, 167, 69, 0.3);
}

.legend-color.no-reports {
    background: rgba(255, 255, 255, 0.7);
    border-color: rgba(0, 0, 0, 0.1);
}

.loading-indicator {
    text-align: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    margin: 10px 0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 123, 255, 0.1);
    border-left: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

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

.error-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #dc3545;
    font-size: 1.1em;
    background: rgba(220, 53, 69, 0.1);
    border-radius: 8px;
    border: 2px solid rgba(220, 53, 69, 0.3);
}

/* Mobile Responsive Calendar */
@media (max-width: 768px) {
    /* Mobile layout styles */
    .desktop-layout {
        display: none;
    }
    
    .mobile-layout {
        display: block;
        max-width: 95%;
        margin: 0 auto;
        font-size: 0.8em;
    }
    
    /* Responsive main content styling */
    .main-content {
        margin: 0;
        border-radius: 0;
    }
    
    /* Reduce content padding for mobile */
    .main-content .content {
        padding: 10px 15px;
    }
    
    /* Optimize calendar header for mobile */
    .mobile-layout .calendar-header {
        gap: 10px;
        padding: 8px;
        margin: 10px 0 10px 0;
    }
    
    .mobile-layout #currentMonthMobile {
        font-size: 1.1em;
        min-width: 180px;
    }
    
    /* Optimize calendar container width */
    .calendar-container {
        padding: 10px;
        background: rgba(255, 255, 255, 0.5);
        border-radius: 12px;
        margin: 10px 0;
        backdrop-filter: blur(10px);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    }
    
    /* Increase calendar cell height and improve spacing */
    .calendar-day {
        height: 90px;
        font-size: 0.9em;
        padding: 3px;
    }
    
    .day-number {
        font-size: 1.0em;
        font-weight: 600;
    }
    
    /* Make report times more readable */
    .report-link-inline {
        font-size: 0.65em;
        padding: 2px 3px;
        margin: 1px 0;
        min-height: 14px;
        line-height: 1.2;
    }
    
    .no-reports-text {
        font-size: 0.55em;
        margin-top: 1px;
    }
    
    .calendar-legend {
        gap: 15px;
        padding: 12px;
    }
    
    .legend-item {
        font-size: 0.8em;
        gap: 6px;
    }
    
    .legend-color {
        width: 14px;
        height: 14px;
    }
}

@media (max-width: 480px) {
    /* Further optimize for very small screens */
    .main-content .content {
        padding: 10px 10px;
    }
    
    .mobile-layout .calendar-header {
        gap: 8px;
        padding: 8px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .mobile-layout #currentMonthMobile {
        font-size: 1.0em;
        min-width: 160px;
    }
    
    .calendar-nav-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .calendar-container {
        padding: 2px;
        width: 100%;
        overflow-x: hidden;
        max-width: 100%;
    }
    
    .weekday {
        padding: 4px 1px;
        font-size: 0.7em;
    }
    
    /* Make calendar cells fit on small screens */
    .calendar-day {
        height: auto;
        aspect-ratio: 1/1;
        font-size: 0.65em;
        padding: 1px;
        min-height: 0;
    }
    
    .day-number {
        font-size: 0.75em;
        font-weight: 600;
    }
    
    /* Keep report times readable */
    .report-link-inline {
        font-size: 0.6em;
        padding: 1px 2px;
        margin: 1px 0;
        min-height: 12px;
        line-height: 1.1;
    }
    
    .no-reports-text {
        font-size: 0.7em;
        margin-top: 4px;
    }
    
    .calendar-legend {
        gap: 8px;
        padding: 8px;
        flex-wrap: wrap;
    }
    
    .legend-item {
        font-size: 0.75em;
        gap: 4px;
    }
    
    .legend-color {
        width: 12px;
        height: 12px;
    }
}

/* Morse Code Preview Styles */
.morse-preview {
    padding: 20px;
    background: transparent;
    border-radius: 8px;
    height: 100%;
    overflow-y: auto;
    max-width: 100%;
    box-sizing: border-box;
}

.transcript-section {
    margin-top: 20px;
    margin-bottom: 20px;
}

.transcript-section h3 {
    margin-bottom: 10px;
}

.generated-file-section {
    margin-bottom: 20px;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.transcript-display {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 15px;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 300px;
    overflow-y: auto;
}

/* Reduce font size for transcript text in desktop view only */
@media (min-width: 768px) {
    .transcript-display {
        font-size: 12px;
    }
}

.waveform-container {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow: hidden;
    box-sizing: border-box;
    margin-bottom: 15px;
}

.waveform-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: space-between;
}

.waveform-time {
    color: #666;
}

.waveform-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.waveform-btn-play {
    background-color: #0d6efd;
    color: white;
}

.waveform-btn-play:hover {
    background-color: #0b5ed7;
}

.waveform-btn-download {
    background-color: #198754;
    color: white;
}

.waveform-btn-download:hover {
    background-color: #157347;
}

/* Responsive styles for mobile */
@media (max-width: 768px) {
    .generated-file-section {
        padding: 10px;
    }
    
    .waveform-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .waveform-btn {
        margin-bottom: 10px;
        justify-content: center;
    }
    
    .waveform-time {
        text-align: center;
        margin-bottom: 10px;
    }
}

.transcript-section h4 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.transcript-text {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 400px;
    overflow-y: auto;
}

.audio-section {
    margin-bottom: 20px;
}

.audio-section h4 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.download-section {
    text-align: center;
}

.download-btn {
    display: inline-block;
    padding: 10px 20px;
    background: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: background 0.3s ease;
}

.download-btn:hover {
    background: #0056b3;
}

.style-badge {
    display: inline-block;
    padding: 2px 6px;
    background: #007bff;
    color: white;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
    margin-right: 4px;
}

/* Style badges in calendar cells */
.day-reports .report-link-inline .style-badge {
    padding: 1px 4px;
    font-size: 9px;
    margin: 1px 0;
    display: block;
    text-align: center;
    width: 100%;
}

/* Different colors for different styles */
.style-badge[data-style="CQ"] {
    background: #007bff;
}

.style-badge[data-style="DX"] {
    background: #28a745;
}

.style-badge[data-style="Contest"] {
    background: #dc3545;
}

.style-badge[data-style="Ragchew"] {
    background: #6f42c1;
}

/* Default color */
.style-badge {
    background: #6c757d;
}

.error-message {
    padding: 15px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    color: #856404;
    margin-bottom: 20px;
    text-align: center;
}

.error-message p {
    margin: 0;
}

/* Transcript syntax highlighting - match morse.css */
.transcript-display .comment { 
    color: #22c55e !important;
    font-weight: bold !important;
}

.transcript-display .operator { 
    color: #007bff !important;
    font-weight: bold !important;
}

.transcript-display .callsign { 
    color: #8b5cf6 !important;
    font-weight: bold !important;
}

.transcript-display .frequency { 
    color: #f59e0b !important;
    font-weight: 500 !important;
}

.transcript-display .report { 
    color: #06b6d4 !important;
    font-weight: 500 !important;
}

.transcript-display .prosign { 
    color: #be185d !important;
    font-weight: bold !important;
}

.transcript-display .morse { 
    color: #1e40af !important;
    font-weight: 600 !important;
    font-family: monospace;
}

/* Transcript List Styles */
.transcript-list-container {
    margin-top: 15px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    padding: 12px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    max-height: calc(100vh - 500px); /* Adjust based on available space */
    overflow-y: auto;
}

.transcript-list-title {
    margin: 0 0 10px 0;
    color: #05208e;
    font-size: 1.1em;
    font-weight: 500;
}

.transcript-table-container {
    max-height: calc(100vh - 550px); /* Adjust based on available space */
    overflow-y: auto;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.transcript-list-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.8);
}

.transcript-list-table th,
.transcript-list-table td {
    padding: 6px 10px; /* Reduced vertical spacing */
    text-align: left;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.transcript-list-table th {
    background: #05208e;
    color: white;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.transcript-list-table tr:hover {
    background: rgba(0, 123, 255, 0.1);
}

.transcript-list-table .selected-row {
    background: rgba(0, 123, 255, 0.2);
}

.clickable-row {
    cursor: pointer;
    transition: background-color 0.2s;
}

.clickable-row:hover {
    background: rgba(0, 123, 255, 0.1);
}

.view-btn {
    background: #05208e;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s ease;
}

.view-btn:hover {
    background: #041a73;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Footer styles */
.footer {
    width: 100%;
    background: rgba(255, 255, 255, 0.3);
    color: #6c757d;
    padding: 20px 0;
    border-top: 1px solid rgba(0,0,0,0.1);
    margin-top: auto;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.service-info {
    font-size: 0.9em;
}

.service-info p {
    margin: 5px 0;
}

.service-info a {
    color: #05208e;
    text-decoration: none;
}

.service-info a:hover {
    text-decoration: underline;
}
