/* Broiler Farm Dashboard Styling */

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

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --light-bg: #ecf0f1;
    --text-color: #2c3e50;
    --border-color: #bdc3c7;
}

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

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

/* Header */
.header {
    background: white;
    border-radius: 10px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.header h1 {
    color: var(--primary-color);
    font-size: 2em;
}

.header-info {
    display: flex;
    gap: 20px;
    align-items: center;
}

#current-time {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--secondary-color);
}

.status-badge {
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: bold;
    color: white;
    font-size: 1.1em;
}

/* Main Content */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Current Readings Section */
.current-readings {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--light-bg);
}

.section-header h2 {
    color: var(--primary-color);
    font-size: 1.5em;
}

.data-source {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
}

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

.reading-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.reading-card:hover {
    transform: translateY(-5px);
}

.reading-icon {
    font-size: 3em;
    margin-bottom: 10px;
}

.reading-value {
    font-size: 2.5em;
    font-weight: bold;
    color: var(--secondary-color);
    margin: 10px 0;
    font-family: 'Courier New', monospace;
}

.reading-label {
    font-size: 0.9em;
    color: var(--text-color);
    font-weight: 600;
    margin-bottom: 5px;
}

.reading-status {
    font-size: 0.85em;
    color: #27ae60;
    padding: 5px 10px;
    background: rgba(39, 174, 96, 0.1);
    border-radius: 5px;
    margin-top: 10px;
}

/* Status Section */
.status-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.status-card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease;
}

.status-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
}

.card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    font-weight: bold;
    font-size: 1.1em;
}

.card-body {
    padding: 20px;
}

.status-indicator {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin: 0 auto 15px;
    animation: pulse 2s infinite;
}

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

.status-text {
    text-align: center;
    font-size: 1.5em;
    font-weight: bold;
    margin-bottom: 15px;
}

.status-details p {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--light-bg);
}

.status-details p:last-child {
    border-bottom: none;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--light-bg);
}

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

.stat-label {
    font-weight: 600;
    color: var(--text-color);
}

.stat-value {
    font-weight: bold;
    color: var(--secondary-color);
    font-size: 1.1em;
}

/* Alerts Section */
.alerts-section,
.recommendations-section {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-refresh {
    background: var(--secondary-color);
    color: white;
}

.btn-refresh:hover {
    background: #2980b9;
}

.btn-refresh:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Alerts Table */
.alerts-container {
    overflow-x: auto;
    margin-bottom: 20px;
}

.alerts-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
}

.alerts-table thead {
    background: var(--light-bg);
}

.alerts-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: var(--primary-color);
    border-bottom: 2px solid var(--border-color);
}

.alerts-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.alerts-table tbody tr {
    transition: background-color 0.2s ease;
}

.alerts-table tbody tr:hover {
    background-color: var(--light-bg);
}

.alerts-table tr.critical {
    border-left: 4px solid #ff4444;
    background-color: rgba(255, 68, 68, 0.05);
}

.alerts-table tr.high {
    border-left: 4px solid #ffaa00;
    background-color: rgba(255, 170, 0, 0.05);
}

.alerts-table tr.medium {
    border-left: 4px solid #ffff00;
    background-color: rgba(255, 255, 0, 0.05);
}

.alerts-table tr.low {
    border-left: 4px solid #44ff44;
    background-color: rgba(68, 255, 68, 0.05);
}

/* Pagination Styles */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 2px solid var(--light-bg);
    flex-wrap: wrap;
    gap: 15px;
}

.pagination-info {
    color: var(--text-color);
    font-size: 0.9em;
    font-weight: 600;
}

.pagination-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.btn-pagination {
    padding: 8px 15px;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 0.9em;
}

.btn-pagination:hover:not(:disabled) {
    background: #2980b9;
    transform: scale(1.05);
}

.btn-pagination:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.page-numbers {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.btn-page-number {
    padding: 6px 12px;
    background: var(--light-bg);
    color: var(--text-color);
    border: 2px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    font-size: 0.85em;
}

.btn-page-number:hover {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

.btn-page-number.active {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

.page-dots {
    display: inline-flex;
    align-items: center;
    padding: 0 4px;
    color: var(--text-color);
    font-weight: 600;
    user-select: none;
}

/* Recommendations */
.recommendations-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.recommendation-item {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-left: 4px solid var(--secondary-color);
    padding: 15px;
    border-radius: 5px;
}

.recommendation-item h4 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 1.1em;
}

.recommendation-item p {
    color: var(--text-color);
    margin-bottom: 10px;
    font-size: 0.95em;
}

.action-list {
    margin-top: 15px;
}

.action-item {
    background: white;
    padding: 8px 12px;
    margin: 5px 0;
    border-radius: 4px;
    border-left: 3px solid var(--success-color);
    color: var(--text-color);
    font-size: 0.9em;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

/* Footer */
.footer {
    background: rgba(0, 0, 0, 0.1);
    color: white;
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    border-radius: 10px;
}

.footer p {
    margin: 5px 0;
}

.footer small {
    opacity: 0.8;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
    }

    .header h1 {
        font-size: 1.5em;
    }

    .section-header {
        flex-direction: column;
        gap: 10px;
    }

    .section-header h2 {
        font-size: 1.2em;
    }

    .alerts-table {
        font-size: 0.85em;
    }

    .alerts-table th,
    .alerts-table td {
        padding: 8px;
    }

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

    .readings-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .pagination-container {
        flex-direction: column;
        align-items: center;
    }

    .pagination-controls {
        justify-content: center;
    }

    .page-numbers {
        justify-content: center;
    }
}

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

.status-card,
.alerts-section,
.recommendations-section,
.current-readings {
    animation: fadeIn 0.5s ease-out;
}
