/* ==========================================
   KromMetal - Admin Panel CSS
   ========================================== */

/* Admin Login */
.admin-login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--background);
    padding: 1rem;
}

.admin-login-card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    padding: 2rem;
}

.admin-login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.admin-login-icon {
    width: 4rem;
    height: 4rem;
    background: var(--primary);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    color: white;
}

.admin-login-icon svg {
    width: 2rem;
    height: 2rem;
}

.admin-login-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.admin-login-header p {
    color: var(--text-light);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.alert {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
}

/* Admin Header */
.admin-header {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 0 1rem;
}

.admin-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 4rem;
    max-width: 1280px;
    margin: 0 auto;
}

.admin-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.admin-header-left a {
    color: var(--text-light);
}

.admin-header-left a:hover {
    color: var(--primary);
}

.admin-header-left h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}

/* Admin Main */
.admin-main {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (min-width: 640px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.stat-card {
    display: block;
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s;
}

.stat-card:hover {
    box-shadow: var(--shadow-lg);
}

.stat-card-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-card-info p {
    font-size: 0.875rem;
    color: var(--text-light);
    margin: 0;
}

.stat-card-info h3 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0.25rem 0 0;
}

.stat-card-icon {
    width: 3rem;
    height: 3rem;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.stat-card-icon.blue {
    background: #3b82f6;
}

.stat-card-icon.green {
    background: #22c55e;
}

.stat-card-icon.amber {
    background: #f59e0b;
}

.stat-card-icon.red {
    background: #ef4444;
}

.stat-card-icon svg {
    width: 1.5rem;
    height: 1.5rem;
}

/* Admin Grid */
.admin-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 1024px) {
    .admin-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Admin Card */
.admin-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.admin-card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-card-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
}

.admin-card-content {
    padding: 1.5rem;
}

/* Admin Buttons */
.admin-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: white;
    color: var(--text);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 0.75rem;
    text-decoration: none;
}

.admin-btn:hover {
    background: var(--background);
    border-color: var(--primary);
}

.admin-btn svg {
    width: 1rem;
    height: 1rem;
}

/* Table */
.table-container {
    overflow-x: auto;
}

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

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-light);
    background: var(--background);
}

.table td {
    font-size: 0.875rem;
}

.table tr:hover {
    background: var(--background);
}

.table img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: var(--radius);
}

/* Badge */
.badge {
    display: inline-flex;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-green {
    background: #dcfce7;
    color: #166534;
}

.badge-red {
    background: #fee2e2;
    color: #991b1b;
}

.badge-blue {
    background: #dbeafe;
    color: #1e40af;
}

.badge-amber {
    background: #fef3c7;
    color: #92400e;
}

/* Table Actions */
.table-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.table-btn {
    padding: 0.5rem;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: var(--radius);
    transition: background 0.2s;
}

.table-btn:hover {
    background: var(--background);
}

.table-btn svg {
    width: 1rem;
    height: 1rem;
}

.table-btn.edit {
    color: var(--primary);
}

.table-btn.delete {
    color: var(--accent);
}

.table-btn.view {
    color: #3b82f6;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal {
    background: white;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    justify-content: flex-end;
}

/* Image Upload */
.image-upload {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    background: var(--background);
    cursor: pointer;
    transition: all 0.2s;
}

.image-upload:hover {
    border-color: var(--primary);
}

.image-upload svg {
    width: 3rem;
    height: 3rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.image-upload p {
    color: var(--text-light);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.image-preview {
    margin-top: 1rem;
}

.image-preview img {
    max-width: 200px;
    max-height: 200px;
    border-radius: var(--radius);
}

/* Recent Products */
.recent-product {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: var(--background);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
}

.recent-product:last-child {
    margin-bottom: 0;
}

.recent-product-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.recent-product-info img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: var(--radius);
}

.recent-product-info .placeholder {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.recent-product-info p {
    font-weight: 500;
    font-size: 0.875rem;
    margin: 0;
}

.recent-product-info span {
    font-size: 0.75rem;
    color: var(--text-light);
}

.recent-product-price {
    text-align: right;
}

.recent-product-price p {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.875rem;
    margin: 0;
}

.recent-product-price span {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* Messages */
.message-item {
    padding: 1rem;
    background: var(--background);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    border-left: 3px solid var(--primary);
}

.message-item.unread {
    border-left-color: var(--secondary);
    background: #fffbeb;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.message-header h4 {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0;
}

.message-header span {
    font-size: 0.75rem;
    color: var(--text-light);
}

.message-item p {
    font-size: 0.875rem;
    color: var(--text);
    margin: 0 0 0.5rem;
}

.message-item .contact-info {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* Admin Navigation */
.admin-nav {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 0 1rem;
}

.admin-nav-content {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
}

.admin-nav a {
    padding: 1rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-light);
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: all 0.2s;
}

.admin-nav a:hover,
.admin-nav a.active {
    color: var(--primary);
    border-bottom-color: var(--secondary);
}

/* Price Update Form */
.price-update-form {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.price-update-form h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 1rem;
}

.price-update-form p {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .admin-main {
        padding: 1rem;
    }
    
    .admin-card-header,
    .admin-card-content {
        padding: 1rem;
    }
    
    .table th,
    .table td {
        padding: 0.75rem;
    }
    
    .modal {
        margin: 1rem;
    }
}
