/* Reset và Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

/* Toast Notification System */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 400px;
    width: 100%;
}

.toast {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-bottom: 10px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease-in-out;
    border-left: 4px solid #ddd;
    position: relative;
    overflow: hidden;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.hide {
    transform: translateX(100%);
    opacity: 0;
}

.toast-icon {
    margin-right: 12px;
    font-size: 20px;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 14px;
}

.toast-message {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #999;
    padding: 0;
    margin-left: 12px;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.toast-close:hover {
    background-color: rgba(0, 0, 0, 0.1);
    color: #333;
}

/* Toast Progress Bar */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background-color: rgba(255, 255, 255, 0.3);
    transition: width linear;
}

/* Toast Types */
.toast.success {
    border-left-color: #10b981;
}

.toast.success .toast-icon {
    color: #10b981;
}

.toast.success .toast-progress {
    background-color: #10b981;
}

.toast.error {
    border-left-color: #ef4444;
}

.toast.error .toast-icon {
    color: #ef4444;
}

.toast.error .toast-progress {
    background-color: #ef4444;
}

.toast.warning {
    border-left-color: #f59e0b;
}

.toast.warning .toast-icon {
    color: #f59e0b;
}

.toast.warning .toast-progress {
    background-color: #f59e0b;
}

.toast.info {
    border-left-color: #3b82f6;
}

.toast.info .toast-icon {
    color: #3b82f6;
}

.toast.info .toast-progress {
    background-color: #3b82f6;
}

/* Responsive */
@media (max-width: 768px) {
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .toast {
        padding: 12px 16px;
    }
}

/* Confirmation Modal System */
.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.confirm-overlay.show {
    opacity: 1;
    visibility: visible;
}

.confirm-modal {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    max-width: 450px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.9) translateY(-20px);
    transition: all 0.3s ease;
}

.confirm-overlay.show .confirm-modal {
    transform: scale(1) translateY(0);
}

.confirm-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 12px;
}

.confirm-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.confirm-icon.danger {
    background: #fef2f2;
    color: #dc2626;
}

.confirm-icon.warning {
    background: #fffbeb;
    color: #d97706;
}

.confirm-icon.info {
    background: #eff6ff;
    color: #2563eb;
}

.confirm-icon.success {
    background: #f0fdf4;
    color: #16a34a;
}

.confirm-title {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.confirm-body {
    padding: 16px 24px 24px;
}

.confirm-message {
    color: #6b7280;
    line-height: 1.6;
    margin: 0;
    font-size: 14px;
}

.confirm-actions {
    padding: 0 24px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.confirm-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.confirm-btn:hover {
    transform: translateY(-1px);
}

.confirm-btn:active {
    transform: translateY(0);
}

.confirm-btn.primary {
    background: #dc2626;
    color: white;
}

.confirm-btn.primary:hover {
    background: #b91c1c;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.confirm-btn.secondary {
    background: #f8fafc;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.confirm-btn.secondary:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.confirm-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.confirm-btn.loading {
    pointer-events: none;
}

.confirm-btn .spinner {
    width: 14px;
    height: 14px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive confirm modal */
@media (max-width: 480px) {
    .confirm-modal {
        width: 95%;
        margin: 20px;
    }

    .confirm-header {
        padding: 20px 20px 12px;
    }

    .confirm-body {
        padding: 12px 20px 20px;
    }

    .confirm-actions {
        padding: 0 20px 20px;
        flex-direction: column-reverse;
    }

    .confirm-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Connection Status Indicator */
.connection-status {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9998;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    display: none;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.connection-status.show {
    display: flex;
}

.connection-status.online {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.connection-status.offline {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.connection-status.reconnecting {
    background: #fef3c7;
    color: #d97706;
    border: 1px solid #fed7aa;
}

.connection-status .status-icon {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.connection-status.reconnecting .status-icon {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Admin Container */
.admin-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 0;
}

.sidebar-menu li {
    margin: 5px 0;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s ease;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-right: 3px solid #fff;
}

.sidebar-menu i {
    margin-right: 10px;
    width: 20px;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 250px;
    padding: 20px;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.content-header h1 {
    font-size: 2rem;
    color: #333;
}

.user-info {
    color: #666;
}

/* 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: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 20px;
    font-size: 1.5rem;
    color: white;
}

.stat-card:nth-child(1) .stat-icon {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.stat-card:nth-child(2) .stat-icon {
    background: linear-gradient(135deg, #f093fb, #f5576c);
}

.stat-card:nth-child(3) .stat-icon {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
}

.stat-card:nth-child(4) .stat-icon {
    background: linear-gradient(135deg, #43e97b, #38f9d7);
}

.stat-info h3 {
    font-size: 2rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 5px;
}

.stat-info p {
    color: #666;
    font-size: 0.9rem;
}

/* Content Sections */
.content-section {
    background: white;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.content-section h2 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.5rem;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    align-items: end;
}

.filter-grid .form-group {
    margin-bottom: 0;
}

.filter-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.data-table th,
.data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.data-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.data-table tr:hover {
    background-color: #f8f9fa;
}

.text-center {
    text-align: center;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #43e97b, #38f9d7);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.form-help {
    display: block;
    margin-top: 6px;
    color: #666;
    font-size: 0.85rem;
}

/* Status badges */
.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-pending {
    background-color: #fff3cd;
    color: #856404;
}

.status-processing {
    background-color: #d1ecf1;
    color: #0c5460;
}

.status-completed {
    background-color: #d4edda;
    color: #155724;
}

.status-cancelled {
    background-color: #f8d7da;
    color: #721c24;
}

.status-failed {
    background-color: #f8d7da;
    color: #721c24;
}

/* Modal Styles */
.modal {
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h2 {
    margin: 0;
    color: #333;
}

.close {
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
}

.close:hover {
    color: #333;
}

.modal form {
    padding: 20px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

/* Setting cards */
.setting-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.setting-card h3 {
    margin-bottom: 15px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.setting-card .form-group {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.setting-card .form-control {
    flex: 1;
}

.media-setting-controls {
    margin-bottom: 10px;
}

.upload-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 10px;
}

.upload-row .form-control {
    flex: 1;
}

.setting-preview {
    display: none;
    width: 80px;
    height: 80px;
    object-fit: cover;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-top: 12px;
    background: #f8f9fa;
}

.setting-preview-wide {
    width: 100%;
    max-width: 320px;
    height: 120px;
}

.theme-setting-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.theme-color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.color-setting {
    display: block;
    padding: 12px;
    border: 1px solid #eef0f3;
    border-radius: 8px;
    background: #fafafa;
}

.color-setting span {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-size: 0.9rem;
    font-weight: 600;
}

.color-setting-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-setting-controls input[type="color"] {
    width: 46px;
    height: 38px;
    padding: 2px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    cursor: pointer;
}

.color-setting-controls strong {
    color: #333;
    font-family: Consolas, Monaco, monospace;
    font-size: 0.9rem;
    text-transform: uppercase;
}

.theme-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px;
    border: 1px solid #f5b6cc;
    border-radius: 10px;
    background: #fff0f6;
    color: #4a1028;
}

.theme-preview span {
    display: block;
    margin-bottom: 4px;
    color: inherit;
    opacity: 0.68;
    font-size: 0.8rem;
}

.theme-preview strong {
    display: block;
    color: inherit;
}

.theme-preview button {
    padding: 10px 14px;
    border: 0;
    border-radius: 6px;
    background: #e91e63;
    color: white;
    cursor: default;
    font-weight: 600;
    white-space: nowrap;
}

/* Action buttons */
.action-buttons {
    display: flex;
    gap: 5px;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.8rem;
}

/* Pagination Styles */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    flex-wrap: wrap;
    gap: 15px;
}

.pagination-info {
    color: #666;
    font-size: 14px;
}

.pagination-buttons {
    display: flex;
    gap: 5px;
    align-items: center;
}

.pagination-buttons .btn,
.pagination-buttons button {
    min-width: 36px;
    height: 36px;
    padding: 6px 12px;
    border: 1px solid #dcdfe6;
    background: #ffffff;
    color: #34495e;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 14px;
    line-height: 1;
}

.pagination-buttons .btn:hover:not(.disabled):not(.btn-primary),
.pagination-buttons button:hover:not(:disabled):not(.active) {
    background: #f7f9fc;
    border-color: #409eff;
    color: #409eff;
}

.pagination-buttons .btn.btn-primary,
.pagination-buttons button.active {
    background: #409eff;
    color: #ffffff;
    border-color: #409eff;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(64, 158, 255, 0.25);
}

.pagination-buttons .btn.disabled,
.pagination-buttons button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f2f3f5;
    color: #a0a3a6;
}

.pagination-info {
    color: #606266;
}

.pagination-size select {
    padding: 6px 10px;
    border-radius: 6px;
}

.pagination-size {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pagination-size label {
    font-size: 14px;
    color: #666;
    margin: 0;
}

.pagination-size select {
    padding: 5px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .main-content {
        margin-left: 0;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .modal-content {
        width: 95%;
        margin: 10px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .pagination-container {
        flex-direction: column;
        align-items: stretch;
    }

    .pagination-buttons {
        justify-content: center;
        flex-wrap: wrap;
    }

    .pagination-size {
        justify-content: center;
    }
}
