/**
 * Affordable Climate Control Admin Panel Styles
 */

/* ======== Base Styles ======== */
:root {
    --primary-color: #0056b3;
    --primary-dark: #004494;
    --primary-light: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --bg-color: #f5f6f8;
    --border-color: #dee2e6;
    --sidebar-width: 250px;
    --header-height: 60px;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --radius: 4px;
    --transition: all 0.3s ease;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.admin-page {
    background-color: var(--bg-color);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #333;
    min-height: 100vh;
    display: flex;
    margin: 0;
    padding: 0;
}

.admin-login-page {
    background: linear-gradient(135deg, #0056b3 0%, #004494 100%);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #333;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
    text-decoration: none;
}

/* ======== Admin Sidebar ======== */
.admin-sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background-color: #fff;
    box-shadow: var(--shadow);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
}

.admin-sidebar .sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.admin-sidebar .sidebar-logo {
    text-align: center;
}

.admin-sidebar .sidebar-logo h1 {
    margin: 0;
    color: var(--primary-color);
    font-size: 24px;
    font-weight: bold;
}

.admin-sidebar .sidebar-logo .tagline {
    font-size: 12px;
    color: var(--secondary-color);
    margin: 0;
}

.admin-sidebar .sidebar-menu {
    padding: 15px;
    flex: 1;
}

.admin-sidebar .sidebar-menu h3 {
    font-size: 14px;
    text-transform: uppercase;
    color: var(--secondary-color);
    margin: 15px 0 5px;
    padding-left: 10px;
}

.admin-sidebar .sidebar-menu ul {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
}

.admin-sidebar .sidebar-menu ul li {
    margin-bottom: 2px;
}

.admin-sidebar .sidebar-menu ul li a {
    display: flex;
    align-items: center;
    padding: 10px;
    color: #333;
    border-radius: var(--radius);
    transition: var(--transition);
}

.admin-sidebar .sidebar-menu ul li a:hover,
.admin-sidebar .sidebar-menu ul li a.active {
    background-color: rgba(0, 86, 179, 0.1);
    color: var(--primary-color);
}

.admin-sidebar .sidebar-menu ul li a i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

.admin-sidebar .sidebar-footer {
    padding: 15px;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--secondary-color);
    text-align: center;
}

/* ======== Admin Header ======== */
.admin-header {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--header-height);
    background-color: #fff;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 990;
    transition: var(--transition);
}

.admin-header .sidebar-toggle {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--secondary-color);
    cursor: pointer;
    padding: 5px;
    margin-right: 15px;
}

.admin-header .header-tools {
    display: flex;
    align-items: center;
    flex: 1;
    justify-content: flex-end;
}

.admin-header .header-search {
    position: relative;
    margin-right: 20px;
}

.admin-header .header-search input {
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 8px 15px 8px 35px;
    width: 200px;
    transition: var(--transition);
}

.admin-header .header-search input:focus {
    width: 250px;
    border-color: var(--primary-color);
    outline: none;
}

.admin-header .header-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary-color);
}

.admin-header .header-menu {
    display: flex;
    align-items: center;
}

.admin-header .notification {
    position: relative;
    margin-right: 20px;
    cursor: pointer;
}

.admin-header .notification i {
    font-size: 18px;
    color: var(--secondary-color);
}

.admin-header .notification .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--danger-color);
    color: white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-header .user-dropdown {
    display: flex;
    align-items: center;
    cursor: pointer;
    position: relative;
}

.admin-header .user-avatar {
    width: 36px;
    height: 36px;
    background-color: var(--primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-right: 10px;
}

.admin-header .dropdown-toggle {
    display: flex;
    flex-direction: column;
}

.admin-header .user-name {
    font-weight: bold;
    font-size: 14px;
}

.admin-header .user-role {
    font-size: 12px;
    color: var(--secondary-color);
}

.admin-header .dropdown-menu {
    position: absolute;
    top: 45px;
    right: 0;
    background-color: white;
    box-shadow: var(--shadow);
    border-radius: var(--radius);
    padding: 10px 0;
    min-width: 180px;
    display: none;
    z-index: 1000;
}

.admin-header .dropdown-menu.show {
    display: block;
}

.admin-header .dropdown-menu a {
    display: block;
    padding: 8px 15px;
    color: #333;
    transition: var(--transition);
}

.admin-header .dropdown-menu a:hover {
    background-color: rgba(0, 123, 255, 0.1);
    color: var(--primary-color);
}

.admin-header .dropdown-menu a i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

.admin-header .dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 5px 0;
}

/* ======== Admin Content ======== */
.admin-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    padding: 20px;
    transition: var(--transition);
}

.page-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.page-title h1 {
    margin: 0;
    font-size: 24px;
    font-weight: bold;
    color: var(--dark-color);
}

.action-buttons {
    display: flex;
    gap: 10px;
}

/* ======== Period Banner ======== */
.period-banner {
    background-color: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 15px 20px;
    margin-bottom: 20px;
    text-align: center;
}

.period-banner h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--primary-color);
}

/* ======== Dashboard Cards ======== */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stats-card {
    background-color: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    display: flex;
    transition: var(--transition);
}

.stats-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.stats-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-right: 15px;
    color: white;
}

.stats-icon.primary {
    background-color: var(--primary-color);
}

.stats-icon.success {
    background-color: var(--success-color);
}

.stats-icon.danger {
    background-color: var(--danger-color);
}

.stats-icon.warning {
    background-color: var(--warning-color);
}

.stats-icon.info {
    background-color: var(--info-color);
}

.stats-icon.purple {
    background-color: #6f42c1;
}

.stats-info {
    flex: 1;
}

.stats-value {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 5px;
}

.stats-label {
    font-size: 14px;
    color: var(--secondary-color);
    margin-bottom: 5px;
}

.stats-change {
    font-size: 12px;
    display: flex;
    align-items: center;
}

.stats-change i {
    margin-right: 5px;
}

.stats-change.up {
    color: var(--success-color);
}

.stats-change.down {
    color: var(--danger-color);
}

/* ======== Chart Container ======== */
.chart-container {
    background-color: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.chart-title {
    margin: 0;
    font-size: 18px;
    font-weight: bold;
}

.chart-tools, .chart-actions {
    display: flex;
    gap: 10px;
}

/* ======== Table Container ======== */
.table-container {
    background-color: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
}

.table-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: bold;
}

.table-tools {
    display: flex;
    align-items: center;
    gap: 15px;
}

.table-search {
    position: relative;
}

.table-search input {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 8px 15px 8px 35px;
    width: 200px;
    transition: var(--transition);
}

.table-search input:focus {
    border-color: var(--primary-color);
    outline: none;
}

.table-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary-color);
}

.table-responsive {
    overflow-x: auto;
}

.table-container table {
    width: 100%;
    border-collapse: collapse;
}

.table-container table th,
.table-container table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table-container table th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.table-container table tbody tr {
    transition: var(--transition);
}

.table-container table tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.05);
}

.table-container table tbody tr:last-child td {
    border-bottom: none;
}

.table-container .btn-icon {
    background: none;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--secondary-color);
    cursor: pointer;
    transition: var(--transition);
}

.table-container .btn-icon:hover {
    background-color: rgba(108, 117, 125, 0.1);
    color: var(--primary-color);
}

.table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
}

.table-info {
    font-size: 14px;
    color: var(--secondary-color);
}

.table-pagination {
    display: flex;
    align-items: center;
    gap: 5px;
}

.page-item {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
}

.page-item:hover {
    background-color: rgba(0, 123, 255, 0.1);
}

.page-item.active {
    background-color: var(--primary-color);
    color: white;
}

/* ======== Toast Messages ======== */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

.toast-message {
    background-color: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 15px;
    margin-bottom: 10px;
    min-width: 300px;
    display: flex;
    align-items: center;
    animation: toast-slide-in 0.3s ease-out forwards;
    opacity: 0;
    transform: translateX(50px);
}

@keyframes toast-slide-in {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toast-slide-out {
    to {
        opacity: 0;
        transform: translateX(50px);
    }
}

.toast-message.hide {
    animation: toast-slide-out 0.3s ease-out forwards;
}

.toast-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-right: 15px;
    flex-shrink: 0;
}

.toast-icon.success {
    background-color: var(--success-color);
}

.toast-icon.error {
    background-color: var(--danger-color);
}

.toast-icon.warning {
    background-color: var(--warning-color);
}

.toast-icon.info {
    background-color: var(--info-color);
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: bold;
    margin-bottom: 5px;
}

.toast-message p {
    margin: 0;
    font-size: 14px;
    color: var(--secondary-color);
}

.toast-close {
    background: none;
    border: none;
    color: var(--secondary-color);
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    margin-left: 10px;
    opacity: 0.7;
    transition: var(--transition);
}

.toast-close:hover {
    opacity: 1;
}

/* ======== Modal Styles ======== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.active, 
.modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
}

/* Payment modal specific styling */
#paymentModal {
    z-index: 10000; /* Ensure it appears above other elements */
}

#paymentModal .modal-content {
    max-width: 450px;
    margin: 0 auto;
}

@keyframes modal-slide-down {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content {
    background-color: white;
    border-radius: var(--radius);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 600px;
    position: relative;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: modal-slide-down 0.3s ease-out forwards;
}

.modal-content.modal-lg {
    max-width: 800px;
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.close-modal {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    color: var(--secondary-color);
    transition: var(--transition);
}

.close-modal:hover {
    color: var(--danger-color);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Delete confirmation modal */
.modal#deleteConfirmModal .modal-content {
    max-width: 450px;
}

.delete-info-box {
    background-color: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 15px;
    margin: 15px 0;
}

.delete-info-box p {
    margin: 5px 0;
}

.delete-info-box strong {
    color: var(--dark-color);
}

/* ======== Login Styles ======== */
.admin-container {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    padding: 20px;
}

.login-box {
    background-color: white;
    border-radius: var(--radius);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    padding: 30px;
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo h1 {
    margin: 0;
    color: var(--primary-color);
    font-size: 32px;
    font-weight: bold;
}

.login-logo .tagline {
    font-size: 14px;
    color: var(--secondary-color);
    margin: 5px 0 10px;
}

.login-logo h2 {
    font-size: 20px;
    color: var(--dark-color);
    margin: 15px 0 0;
}

.login-box .form-group {
    position: relative;
    margin-bottom: 20px;
}

.login-box .form-group label {
    position: absolute;
    top: 50%;
    left: 15px;
    transform: translateY(-50%);
    color: var(--secondary-color);
}

.login-box .form-group input {
    width: 100%;
    padding: 12px 12px 12px 40px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    transition: var(--transition);
}

.login-box .form-group input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.btn-login {
    width: 100%;
    padding: 12px;
    margin-top: 10px;
    font-size: 16px;
}

.message-box {
    margin-top: 15px;
    padding: 10px;
    border-radius: var(--radius);
    text-align: center;
}

.message-box.success {
    background-color: rgba(40, 167, 69, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(40, 167, 69, 0.2);
}

.message-box.error {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
    border: 1px solid rgba(220, 53, 69, 0.2);
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
}

/* ======== Form Components ======== */
.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary-color);
    outline: none;
}

.form-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    transition: var(--transition);
}

.form-select:focus {
    border-color: var(--primary-color);
    outline: none;
}

.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: var(--radius);
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: #218838;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

/* ======== Invoice Specific Styles ======== */
.payment-history-item {
    border-bottom: 1px solid #e0e0e0;
    padding: 8px 0;
}

/* Payment Complete Button */
.btn-icon.payment-complete {
    color: var(--success-color);
    background-color: rgba(40, 167, 69, 0.1);
}

.btn-icon.payment-complete:hover {
    background-color: rgba(40, 167, 69, 0.2);
    color: var(--success-color);
}

/* ======== Responsive ======== */
@media (max-width: 992px) {
    .admin-sidebar {
        width: 0;
        overflow: hidden;
    }
    
    .admin-header, 
    .admin-content {
        left: 0;
        margin-left: 0;
    }
    
    .admin-sidebar.show {
        width: var(--sidebar-width);
    }
    
    .admin-header.sidebar-open, 
    .admin-content.sidebar-open {
        left: var(--sidebar-width);
    }
}

@media (max-width: 768px) {
    .dashboard-cards {
        grid-template-columns: 1fr;
    }
    
    .admin-header .header-search {
        display: none;
    }
}

@media (max-width: 576px) {
    .admin-header .user-name,
    .admin-header .user-role {
        display: none;
    }
    
    .admin-content {
        padding: 15px 10px;
    }
}
