/* SSL Certificate Monitor Styles */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f7fa;
}

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

/* Header Styles */
header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px 0;
    background: linear-gradient(135deg, #003d7a 0%, #0052a3 100%);
    color: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.header-logo {
    max-width: 300px;
    height: auto;
    margin-bottom: 10px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Main Content */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Status Bar */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    gap: 15px;
}

/* View Toggle */
.view-toggle {
    display: flex;
    gap: 10px;
}

.view-btn {
    background: #f0f0f0;
    color: #333;
    border: 2px solid #ddd;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.view-btn:hover {
    background: #e0e0e0;
    border-color: #ffc107;
}

.view-btn.active {
    background: #ffc107;
    color: #003d7a;
    border-color: #ffc107;
}

.last-updated {
    display: flex;
    align-items: center;
    gap: 15px;
}

.refresh-btn {
    background: #ffc107;
    color: #003d7a;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
    font-weight: 600;
}

.refresh-btn:hover {
    background: #ffb300;
}

.refresh-btn:active {
    transform: translateY(1px);
}

/* Loading State */
.loading {
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #ffc107;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* Error Message */
.error-message {
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    color: #c33;
}

.error-message h2 {
    margin-bottom: 10px;
    color: #c33;
}

/* Sites Container */
.sites-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.summary-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: center;
    border-left: 4px solid;
}

.summary-card.valid {
    border-left-color: #28a745;
}

.summary-card.warning {
    border-left-color: #ff9800;
}

.summary-card.expired {
    border-left-color: #dc3545;
}

.summary-card.error {
    border-left-color: #6c757d;
}

.summary-card h3 {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-card span {
    font-size: 2rem;
    font-weight: bold;
    display: block;
}

.summary-card.valid span {
    color: #28a745;
}

.summary-card.warning span {
    color: #ff9800;
}

.summary-card.expired span {
    color: #dc3545;
}

.summary-card.error span {
    color: #6c757d;
}

/* Table Styles */
.sites-table-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.sites-table {
    width: 100%;
    border-collapse: collapse;
}

.sites-table th,
.sites-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.sites-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.sites-table tbody tr:hover {
    background: #f8f9fa;
}

.sites-table tbody tr:last-child td {
    border-bottom: none;
}

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.valid {
    background: #d4edda;
    color: #155724;
}

.status-badge.warning {
    background: #fff3e0;
    color: #e65100;
}

.status-badge.expired {
    background: #f8d7da;
    color: #721c24;
}

.status-badge.error {
    background: #e2e3e5;
    color: #383d41;
}

/* Days Remaining */
.days-remaining {
    font-weight: 600;
}

.days-remaining.valid {
    color: #28a745;
}

.days-remaining.warning {
    color: #ff9800;
}

.days-remaining.expired {
    color: #dc3545;
}

.days-remaining.error {
    color: #6c757d;
}

/* Domain Cell */
.domain {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    word-break: break-all;
}

/* Calendar View Styles */
.calendar-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
}

.calendar-month {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: visible;
    width: 100%;
}

.calendar-header {
    background: linear-gradient(135deg, #003d7a 0%, #0052a3 100%);
    color: white;
    padding: 15px;
    text-align: center;
    font-weight: 600;
    font-size: 1.1rem;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #e0e0e0;
    padding: 1px;
    position: relative;
}

.calendar-day-header {
    background: #f5f5f5;
    padding: 10px;
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
    color: #666;
}

.calendar-day {
    background: white;
    padding: 8px;
    min-height: 80px;
    position: relative;
    overflow: visible;
    cursor: pointer;
    transition: all 0.3s ease;
}

.calendar-day.empty {
    background: #e8e8e8;
    cursor: default;
}

.calendar-day.other-month {
     background: #f9f9f9;
     opacity: 0.5;
     cursor: default;
}

.calendar-day.today {
     background: #ffc107;
     font-weight: 600;
}

.calendar-day:hover:not(.empty):not(.other-month) {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
    z-index: 100;
}

.calendar-day.has-sites:hover .day-sites {
    max-height: 600px;
    background: white;
    border: 2px solid #ffc107;
    border-radius: 8px;
    padding: 12px;
    position: absolute;
    top: 100%;
    left: -50%;
    right: auto;
    width: 300px;
    margin-top: 8px;
    box-shadow: 0 8px 24px rgba(255, 193, 7, 0.2);
    z-index: 101;
}

/* Tooltip positioning for right-side days */
.calendar-day.tooltip-left:hover .day-sites {
    left: auto;
    right: -50%;
}

/* Tooltip positioning for left-side days */
.calendar-day.tooltip-right:hover .day-sites {
    left: -50%;
    right: auto;
}

.day-number {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 4px;
    color: #333;
}

.day-sites {
    font-size: 0.75rem;
    line-height: 1.4;
    max-height: 60px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.day-site {
    display: block;
    padding: 6px 8px;
    margin: 4px 0;
    border-radius: 4px;
    white-space: normal;
    word-break: break-word;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.85rem;
    line-height: 1.5;
    font-weight: 500;
}

.day-site.valid {
    background: #d4edda;
    color: #155724;
}

.day-site.warning {
    background: #fff3e0;
    color: #e65100;
}

.day-site.expired {
    background: #f8d7da;
    color: #721c24;
}

.day-site.error {
    background: #e2e3e5;
    color: #383d41;
}

.day-count {
    font-size: 0.7rem;
    color: #999;
    margin-top: 2px;
    font-style: italic;
}

.day-sites-header {
    font-weight: 600;
    font-size: 0.9rem;
    color: #333;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

/* Legend */
.calendar-legend {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.calendar-legend h3 {
    margin-bottom: 15px;
    color: #333;
}

.legend-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 3px;
}

.legend-color.valid {
    background: #d4edda;
    border: 1px solid #155724;
}

.legend-color.warning {
    background: #fff3e0;
    border: 1px solid #e65100;
}

.legend-color.expired {
    background: #f8d7da;
    border: 1px solid #721c24;
}

.legend-color.error {
    background: #e2e3e5;
    border: 1px solid #383d41;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px 0;
    color: #666;
    font-size: 0.9rem;
    border-top: 1px solid #eee;
    margin-top: 40px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .status-bar {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .summary-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .sites-table-container {
        overflow-x: auto;
    }
    
    .sites-table {
        min-width: 600px;
    }
}

@media (max-width: 480px) {
    .summary-cards {
        grid-template-columns: 1fr;
    }
    
    .sites-table th,
    .sites-table td {
        padding: 10px 8px;
        font-size: 0.85rem;
    }
}