/* ============================================
   Monitoring System - Main Stylesheet
   ============================================ */

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

body {
    font-family: 'Vazir', Tahoma, Arial, sans-serif;
    background: #f4f6f9;
    color: #2c3e50;
    direction: rtl;
    line-height: 1.6;
    font-size: 14px;
}

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

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

.login-box {
    background: #fff;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

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

.login-header .logo {
    font-size: 48px;
    margin-bottom: 10px;
}

.login-header h1 {
    font-size: 24px;
    color: #2c3e50;
    margin-bottom: 8px;
}

.login-header p {
    color: #7f8c8d;
}

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

.login-form label {
    display: block;
    margin-bottom: 8px;
    color: #34495e;
    font-weight: 600;
}

.login-form input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e6ed;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s;
}

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

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

.login-footer a {
    color: #667eea;
    text-decoration: none;
}

/* ===== App Layout ===== */
.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: #2c3e50;
    color: #ecf0f1;
    display: flex;
    flex-direction: column;
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    overflow-y: auto;
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}

.sidebar-header .logo {
    font-size: 36px;
    margin-bottom: 8px;
}

.sidebar-header h2 {
    font-size: 16px;
    font-weight: 600;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #bdc3c7;
    text-decoration: none;
    transition: all 0.2s;
    position: relative;
}

.sidebar-nav a:hover {
    background: rgba(255,255,255,0.05);
    color: #fff;
}

.sidebar-nav a.active {
    background: #3498db;
    color: #fff;
}

.sidebar-nav a .icon {
    margin-left: 12px;
    font-size: 18px;
}

.sidebar-nav a .badge {
    margin-right: auto;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-info {
    margin-bottom: 12px;
}

.user-info strong {
    display: block;
    color: #fff;
}

.user-info small {
    color: #95a5a6;
}

.logout-link {
    color: #e74c3c;
    text-decoration: none;
    font-weight: 600;
}

.main-content {
    flex: 1;
    margin-right: 260px;
    padding: 30px;
}

/* ===== Page Header ===== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.page-header h1 {
    font-size: 24px;
    color: #2c3e50;
}

.page-header p {
    color: #7f8c8d;
    margin-top: 5px;
}

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

.stat-card {
    background: #fff;
    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.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

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

.stat-info {
    flex: 1;
}

.stat-label {
    color: #7f8c8d;
    font-size: 13px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #2c3e50;
    margin: 4px 0;
}

.stat-subtitle {
    color: #95a5a6;
    font-size: 12px;
}

/* ===== Cards ===== */
.card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin-bottom: 25px;
    overflow: hidden;
}

.card-header {
    padding: 20px 25px;
    border-bottom: 1px solid #ecf0f1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 16px;
    color: #2c3e50;
}

.card-body {
    padding: 25px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Tables ===== */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px 15px;
    text-align: right;
    border-bottom: 1px solid #ecf0f1;
}

.table th {
    background: #f8f9fa;
    color: #2c3e50;
    font-weight: 600;
    font-size: 13px;
}

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

.table code {
    background: #ecf0f1;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}

.actions {
    white-space: nowrap;
}

.actions form {
    margin: 0;
}

/* ===== Buttons ===== */
.btn {
    padding: 8px 16px;
    background: #ecf0f1;
    color: #2c3e50;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn-primary { background: #3498db; color: #fff; }
.btn-success { background: #2ecc71; color: #fff; }
.btn-warning { background: #f39c12; color: #fff; }
.btn-danger { background: #e74c3c; color: #fff; }
.btn-info { background: #1abc9c; color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; }

/* ===== Forms ===== */
.form-group {
    margin-bottom: 18px;
    flex: 1;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: #34495e;
    font-weight: 600;
    font-size: 13px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #dfe6e9;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3498db;
}

.form-row {
    display: flex;
    gap: 15px;
}

@media (max-width: 600px) {
    .form-row { flex-direction: column; gap: 0; }
}

.form-hint {
    color: #95a5a6;
    font-size: 12px;
    margin-top: 4px;
    display: block;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    cursor: pointer;
}

.checkbox input { width: auto; }

/* ===== Modal ===== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 25px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #ecf0f1;
}

.modal-header h3 {
    color: #2c3e50;
}

.modal .close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #95a5a6;
    padding: 0;
    line-height: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #ecf0f1;
}

.modal h4 {
    margin: 20px 0 10px;
    color: #2c3e50;
    font-size: 15px;
}

/* ===== Badges ===== */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
}

.badge-success { background: #2ecc71; }
.badge-danger { background: #e74c3c; }
.badge-warning { background: #f39c12; }
.badge-info { background: #3498db; }
.badge-secondary { background: #95a5a6; }

/* ===== Alerts ===== */
.alert {
    padding: 12px 18px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-right: 4px solid;
}

.alert-success { background: #d4edda; border-color: #2ecc71; color: #155724; }
.alert-danger { background: #f8d7da; border-color: #e74c3c; color: #721c24; }
.alert-warning { background: #fff3cd; border-color: #f39c12; color: #856404; }
.alert-info { background: #d1ecf1; border-color: #3498db; color: #0c5460; }

/* ===== Alert List ===== */
.alert-list, .alert-list-full {
    list-style: none;
}

.alert-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    border-right: 4px solid;
    background: #f8f9fa;
}

.alert-item.unread {
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.alert-item.severity-info { border-color: #3498db; }
.alert-item.severity-warning { border-color: #f39c12; }
.alert-item.severity-critical { border-color: #e74c3c; }

.alert-icon {
    font-size: 24px;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-content p {
    color: #555;
    margin-bottom: 5px;
}

.alert-content small {
    color: #95a5a6;
}

.alert-actions {
    display: flex;
    gap: 5px;
}

/* ===== Progress Bar ===== */
.progress-bar {
    position: relative;
    background: #ecf0f1;
    height: 24px;
    border-radius: 12px;
    overflow: hidden;
    min-width: 100px;
}

.progress-fill {
    height: 100%;
    transition: width 0.3s;
}

.progress-bar span {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2c3e50;
    font-size: 12px;
    font-weight: 700;
}

/* ===== Uptime ===== */
.uptime {
    font-weight: 700;
}

.uptime.good { color: #2ecc71; }
.uptime.warn { color: #f39c12; }
.uptime.bad { color: #e74c3c; }

/* ===== Filters ===== */
.filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 6px 14px;
    background: #fff;
    color: #2c3e50;
    border: 1px solid #dfe6e9;
    border-radius: 20px;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s;
}

.filter-btn:hover { background: #ecf0f1; }
.filter-btn.active { background: #3498db; color: #fff; border-color: #3498db; }

.filters .separator { color: #bdc3c7; padding: 0 5px; }

/* ===== Code block ===== */
.code-block {
    background: #2c3e50;
    color: #ecf0f1;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    position: relative;
    direction: ltr;
    text-align: left;
}

.code-block pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-all;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.code-block button {
    position: absolute;
    top: 10px;
    left: 10px;
}

/* ===== Helpers ===== */
.text-muted { color: #95a5a6; }
.text-center { text-align: center; }

select {
    padding: 8px 14px;
    border: 1px solid #dfe6e9;
    border-radius: 6px;
    font-family: inherit;
    background: #fff;
    cursor: pointer;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: relative;
        height: auto;
    }
    .main-content {
        margin-right: 0;
        padding: 20px;
    }
    .app {
        flex-direction: column;
    }
}
