/**
 * Shared CSS - Smart Streetlight Management System
 * Common styles used across multiple pages.
 */

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

/* === Base === */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5fa;
    color: #333;
}
.container {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

/* === Buttons === */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    text-decoration: none;
}
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-primary { background: #1976d2; color: #fff; }
.btn-primary:hover { background: #1565c0; }
.btn-success { background: #43a047; color: #fff; }
.btn-success:hover { background: #388e3c; }
.btn-danger { background: #e53935; color: #fff; }
.btn-danger:hover { background: #c62828; }
.btn-warning { background: #ff9800; color: #fff; }
.btn-warning:hover { background: #f57c00; }
.btn-secondary { background: #78909c; color: #fff; }
.btn-secondary:hover { background: #607d8b; }
.btn-outline { background: #fff; border: 1px solid #ddd; color: #666; }
.btn-outline:hover { background: #f5f5f5; }

/* === Badges === */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}
.badge-success { background: #e8f5e9; color: #2e7d32; }
.badge-danger { background: #ffebee; color: #c62828; }
.badge-warning { background: #fff3e0; color: #e65100; }
.badge-info { background: #e3f2fd; color: #1565c0; }
.badge-secondary { background: #eceff1; color: #546e7a; }

/* === Cards & Panels === */
.card, .panel {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
}
.panel-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.panel-header h3 { font-size: 16px; font-weight: 600; color: #333; }
.panel-body { padding: 20px; }
.panel-body.no-padding { padding: 0; }
.panel-scroll { max-height: 350px; overflow-y: auto; }
.panel-full { grid-column: 1 / -1; }

/* === Stat Cards === */
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    gap: 15px;
}
.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
}
.stat-value { font-size: 24px; font-weight: 700; }
.stat-label { font-size: 12px; color: #888; margin-top: 2px; }

/* === Tables === */
table { width: 100%; border-collapse: collapse; }
th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
    font-size: 13px;
}
th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
    position: sticky;
    top: 0;
    z-index: 1;
}
tr:hover { background: #f8f9fa; }

/* === Forms === */
.form-group { margin-bottom: 15px; }
.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    color: #555;
    font-weight: 500;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #1976d2;
    box-shadow: 0 0 0 3px rgba(25,118,210,0.1);
}

/* === Modal === */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}
.modal.show { display: flex; }
.modal-content {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h3 { font-size: 18px; margin: 0; }
.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}
.modal-close:hover { color: #333; }
.modal-body { padding: 20px; }
.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* === Messages === */
.message {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.error, .error-msg {
    background: #ffebee;
    color: #c62828;
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* === Toast === */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 15px 25px;
    background: #323232;
    color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    z-index: 9999;
    transform: translateX(400px);
    transition: transform 0.3s ease;
}
.toast.show { transform: translateX(0); }
.toast.success { background: #43a047; }
.toast.error { background: #e53935; }

/* === Toolbar === */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}
.toolbar-left { display: flex; gap: 10px; flex-wrap: wrap; }
.toolbar-right { display: flex; gap: 10px; }

/* === Pagination === */
.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    padding: 20px;
}
.pagination a, .pagination span {
    padding: 8px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
}
.pagination a:hover { background: #f5f5f5; }
.pagination .active { background: #1976d2; color: #fff; border-color: #1976d2; }
.pagination .disabled { color: #ccc; cursor: not-allowed; }

/* === Tabs === */
.tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    background: #fff;
    padding: 5px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    color: #666;
    font-weight: 500;
    transition: all 0.2s;
}
.tab:hover { background: #f5f5f5; }
.tab.active { background: #1976d2; color: #fff; }

/* === Progress Bar === */
.progress-bar {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}
.progress-bar .fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s;
}
.progress-bar .fill.green { background: #28a745; }
.progress-bar .fill.red { background: #dc3545; }
.progress-bar .fill.blue { background: #007bff; }

/* === Empty State === */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #888;
}

/* === Extra Button Variants === */
.btn-lg { padding: 15px 30px; font-size: 16px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* === Tab Content === */
.tab-content { display: none; }
.tab-content.active { display: block; }
