/**
 * Machine Monitoring System - Stylesheet
 */

/* Reset and Base 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: #f5f7fa;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 28px;
    color: #333;
    margin-bottom: 8px;
}

.login-header p {
    color: #666;
    font-size: 14px;
}

.login-form {
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e8ed;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
}

.text-muted {
    color: #999;
    font-size: 13px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-block {
    width: 100%;
    padding: 12px;
}

/* Alerts */
.alert {
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-error {
    background: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

.alert-success {
    background: #efe;
    color: #3c3;
    border: 1px solid #cfc;
}

/* Dashboard Page */
.dashboard-page {
    background: #f5f7fa;
    min-height: 100vh;
    display: flex;
}

/* Sidebar Navigation */
.sidebar {
    width: 260px;
    background: #2c3e50;
    min-height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    color: white;
    overflow-y: auto;
}

.sidebar-header {
    padding: 25px 20px;
    background: #1a252f;
    border-bottom: 1px solid #34495e;
}

.sidebar-header h2 {
    font-size: 20px;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-header p {
    font-size: 12px;
    color: #95a5a6;
}

.sidebar-menu {
    padding: 15px 0;
}

.menu-item {
    display: block;
    padding: 12px 20px;
    color: #ecf0f1;
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
    font-size: 14px;
}

.menu-item:hover {
    background: #34495e;
    border-left-color: #3498db;
    padding-left: 25px;
}

.menu-item.active {
    background: #34495e;
    border-left-color: #3498db;
    color: white;
}

.menu-item i {
    margin-right: 10px;
    width: 20px;
    display: inline-block;
}

.sidebar-footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    padding: 20px;
    background: #1a252f;
    border-top: 1px solid #34495e;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: #3498db;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.user-details {
    flex: 1;
}

.user-details p {
    margin: 0;
    font-size: 13px;
}

.user-details .user-role {
    font-size: 11px;
    color: #95a5a6;
}

/* Main Content Area */
.main-content {
    margin-left: 260px;
    flex: 1;
    padding: 20px;
    width: calc(100% - 260px);
}

.dashboard-container {
    max-width: 100%;
    margin: 0;
    padding: 0;
}

/* Dashboard Header */
.dashboard-header {
    background: white;
    padding: 20px 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left h1 {
    font-size: 24px;
    color: #333;
    margin-bottom: 4px;
}

.subtitle {
    color: #666;
    font-size: 14px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    padding: 8px 15px;
    background: #f5f7fa;
    border-radius: 6px;
    font-size: 14px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    font-size: 48px;
}

.stat-info h3 {
    font-size: 28px;
    color: #333;
    margin-bottom: 4px;
}

.stat-info p {
    color: #666;
    font-size: 14px;
}

.stat-card.active .stat-icon {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Action Bar */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.auto-refresh {
    color: #666;
    font-size: 14px;
}

/* Machines Section */
.machines-section {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
}

.machines-section h2 {
    margin-bottom: 20px;
    color: #333;
}

.table-responsive {
    overflow-x: auto;
}

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

.machines-table th {
    background: #f5f7fa;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #555;
    font-size: 13px;
    border-bottom: 2px solid #e1e8ed;
}

.machines-table td {
    padding: 15px 12px;
    border-bottom: 1px solid #e1e8ed;
    font-size: 14px;
}

.machines-table tbody tr {
    transition: background 0.2s;
}

.machines-table tbody tr:hover {
    background: #f9fafb;
}

.machine-on {
    background: rgba(102, 126, 234, 0.05);
}

.machine-off {
    background: rgba(200, 200, 200, 0.05);
}

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

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

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

/* Dashboard Footer */
.dashboard-footer {
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 13px;
}

/* Form Styles */
.form-card {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
}

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

.form-group select,
.form-group input[type="number"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e8ed;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group select:focus,
.form-group input[type="number"]:focus {
    outline: none;
    border-color: #667eea;
}

/* Machine Details */
.machine-details {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.detail-row {
    display: grid;
    grid-template-columns: 200px 1fr;
    padding: 15px 0;
    border-bottom: 1px solid #e1e8ed;
}

.detail-label {
    font-weight: 600;
    color: #555;
}

.detail-value {
    color: #333;
}

/* Reports Filters */
.filter-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

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

.filter-actions {
    display: flex;
    gap: 10px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        width: 200px;
    }
    
    .main-content {
        margin-left: 200px;
        width: calc(100% - 200px);
    }
    
    .dashboard-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .header-right {
        flex-direction: column;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .action-bar {
        flex-direction: column;
        gap: 10px;
    }
    
    .machines-table {
        font-size: 12px;
    }
    
    .machines-table th,
    .machines-table td {
        padding: 8px;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 100%;
        position: relative;
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
    }
}
