/* Admin Panel Styles */
.admin-nav {
    display: flex;
    align-items: center;
}

.admin-user {
    color: white;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-dashboard {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
}

.dashboard-title {
    display: flex;
    align-items: center;
    gap: 20px;
}

.dashboard-header h2 {
    margin: 0;
    color: #333;
}

.btn-back-home {
    background: #e74c3c;
    color: white;
    padding: 10px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
}

.btn-back-home:hover {
    background: #c0392b;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(231, 76, 60, 0.3);
}

.btn-back-home i {
    font-size: 12px;
}

/* Product Form */
.product-form {
    border-bottom: 1px solid #eee;
    background: #fff;
}

.form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: #000;
    color: white;
}

.form-header h3 {
    margin: 0;
}

.btn-close {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background 0.3s;
}

.btn-close:hover {
    background: rgba(255,255,255,0.2);
}

.product-form form {
    padding: 30px;
}

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

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: 'Segoe UI', sans-serif;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #000;
}

.image-inputs {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.image-input-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.image-inputs-container {
    width: 100%;
}

.image-input {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: 'Segoe UI', sans-serif;
    transition: border-color 0.3s;
}

.image-input:focus {
    outline: none;
    border-color: #000;
}

.image-upload-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.btn-upload {
    background: #007bff;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
    min-width: 45px;
}

.btn-upload:hover {
    background: #0056b3;
}

.image-preview {
    position: relative;
    width: 80px;
    height: 60px;
    border: 2px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    background: #f8f9fa;
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.btn-remove-preview {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remove-preview:hover {
    background: #c82333;
}

.upload-info {
    background: #e7f3ff;
    border: 1px solid #b3d7ff;
    border-radius: 4px;
    padding: 10px;
    margin-top: 10px;
    font-size: 12px;
    color: #0066cc;
}

.upload-info strong {
    color: #004499;
}

.image-controls {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    margin-bottom: 5px;
}

.btn-small {
    padding: 8px 12px;
    font-size: 12px;
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

/* Products List */
.products-list {
    padding: 0;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.list-header h3 {
    margin: 0;
    color: #333;
}

.list-actions {
    display: flex;
    gap: 10px;
}

.products-table {
    overflow-x: auto;
}

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

.products-table th,
.products-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.products-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.products-table td {
    vertical-align: middle;
}

.product-image {
    width: 60px;
    height: 45px;
    object-fit: cover;
    border-radius: 4px;
}

.product-title {
    font-weight: 600;
    color: #333;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-price {
    font-weight: 600;
    color: #e74c3c;
}

.product-description {
    color: #666;
    font-size: 14px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.action-buttons {
    display: flex;
    gap: 8px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: background 0.3s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-edit {
    background: #007bff;
    color: white;
}

.btn-edit:hover {
    background: #0056b3;
}

.btn-delete {
    background: #dc3545;
    color: white;
}

.btn-delete:hover {
    background: #c82333;
}

.btn-view {
    background: #28a745;
    color: white;
}

.btn-view:hover {
    background: #1e7e34;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background: white;
    margin: 5% auto;
    width: 90%;
    max-width: 600px;
    border-radius: 8px;
    overflow: hidden;
}

/* Login Modal Styles */
.login-modal {
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.login-content {
    max-width: 400px;
    margin: 10% auto;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    background: #000;
    color: white;
    padding: 25px 20px;
    text-align: center;
}

.login-header .logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.login-header .logo-icon {
    background: white;
    color: black;
    padding: 10px 14px;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.2;
    min-width: 60px;
    min-height: 40px;
    border: 2px solid #333;
}

.login-header h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
}

.login-body {
    padding: 25px;
}

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

.login-body label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.login-body label i {
    margin-right: 8px;
    color: #666;
}

.password-input {
    position: relative;
}

.password-input input {
    width: 100%;
    padding: 12px 45px 12px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: 'Segoe UI', sans-serif;
    transition: all 0.3s;
    background: #f8f9fa;
}

.password-input input:focus {
    outline: none;
    border-color: #000;
    background: white;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
    transition: color 0.3s;
}

.toggle-password:hover {
    color: #000;
}

.login-actions {
    margin-top: 20px;
}

.btn-login {
    width: 100%;
    background: #000;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-login:hover {
    background: #333;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-login.loading {
    background: #666;
    cursor: not-allowed;
    pointer-events: none;
}

.login-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    padding: 12px;
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 20%, 40%, 60%, 80% {
        transform: translateX(-3px);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(3px);
    }
    100% {
        transform: translateX(0);
    }
}

.login-footer {
    background: #f8f9fa;
    padding: 15px 20px;
    text-align: center;
    border-top: 1px solid #eee;
}

.login-footer p {
    color: #666;
    font-size: 13px;
    margin: 0;
}

.login-footer i {
    margin-right: 6px;
    color: #28a745;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #000;
    color: white;
}

.modal-header h3 {
    margin: 0;
}

.modal-body {
    padding: 20px;
}

.modal-body textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
}

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

/* Button Styles */
.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

/* Success/Error Messages */
.message {
    padding: 12px 20px;
    margin: 20px 30px;
    border-radius: 4px;
    font-weight: 500;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
        padding: 15px 20px;
    }
    
    .dashboard-title {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .btn-back-home {
        align-self: flex-start;
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .image-inputs {
        grid-template-columns: 1fr;
    }
    
    .image-input-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .image-upload-controls {
        flex-direction: row;
        justify-content: center;
    }
    
    .image-controls {
        flex-direction: column;
    }
    
    .list-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
        padding: 15px 20px;
    }
    
    .list-actions {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .products-table {
        font-size: 14px;
    }
    
    .products-table th,
    .products-table td {
        padding: 8px 6px;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 4px;
    }
    
    .modal-content {
        margin: 10% auto;
        width: 95%;
    }
    
    .product-form form {
        padding: 20px;
    }
    
    .form-header {
        padding: 15px 20px;
    }
    
    .admin-nav {
        flex-direction: column;
        gap: 8px;
        align-items: center;
    }
}

@media (max-width: 480px) {
    .dashboard-header {
        padding: 12px 15px;
    }
    
    .dashboard-header h2 {
        font-size: 1.1rem;
    }
    
    .btn-back-home {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .product-form form {
        padding: 15px;
    }
    
    .form-header {
        padding: 12px 15px;
    }
    
    .form-header h3 {
        font-size: 1.1rem;
    }
    
    .list-header {
        padding: 12px 15px;
    }
    
    .list-header h3 {
        font-size: 1.1rem;
    }
    
    .products-table th,
    .products-table td {
        padding: 6px 4px;
        font-size: 12px;
    }
    
    .product-title {
        max-width: 120px;
    }
    
    .product-description {
        max-width: 100px;
    }
    
    .btn-small {
        padding: 4px 8px;
        font-size: 11px;
    }
    
    .admin-nav {
        gap: 6px;
    }
    
    .admin-user {
        font-size: 12px;
    }
}
/* Status Select Styling */
.form-select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    background-color: white;
    cursor: pointer;
}

.form-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Status Badge in Table */
.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
}

.status-available {
    background-color: #d4edda;
    color: #155724;
}

.status-sold {
    background-color: #f8d7da;
    color: #721c24;
}
/* Bulk Upload Button Styling */
.image-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 15px;
    justify-content: center;
}

.image-controls .btn {
    flex: 0 0 auto;
    min-width: 180px;
    padding: 15px 25px;
    font-size: 16px;
    font-weight: 600;
}

.image-controls .btn-primary {
    background: linear-gradient(135deg, #007bff, #0056b3);
    border: none;
    color: white;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
    border-radius: 8px;
}

.image-controls .btn-primary:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 123, 255, 0.4);
}

.image-controls .btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

.image-controls .btn-primary i {
    margin-right: 8px;
    font-size: 18px;
}

/* Responsive adjustments for image controls */
@media (max-width: 768px) {
    .image-controls {
        flex-direction: column;
    }
    
    .image-controls .btn {
        flex: none;
        width: 100%;
        margin-bottom: 5px;
        min-width: auto;
        padding: 12px 20px;
        font-size: 14px;
    }
}

/* Upload progress styling */
.upload-progress {
    background: #e3f2fd;
    border: 1px solid #2196f3;
    border-radius: 4px;
    padding: 10px;
    margin: 10px 0;
    font-size: 14px;
    color: #1976d2;
}

.upload-progress.success {
    background: #e8f5e8;
    border-color: #4caf50;
    color: #2e7d32;
}

.upload-progress.warning {
    background: #fff3e0;
    border-color: #ff9800;
    color: #f57c00;
}

.upload-progress.error {
    background: #ffebee;
    border-color: #f44336;
    color: #c62828;
}
/* Modern Grid Layout for Images */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
    min-height: 150px;
    margin-bottom: 15px;
}

.image-card {
    position: relative;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: move;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
}

.image-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.image-card.dragging {
    opacity: 0.7;
    transform: rotate(5deg) scale(1.05);
    z-index: 1000;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.image-card.drag-over {
    border: 2px solid #007bff;
    background: #e3f2fd;
}

/* Image card styling - no empty cards */

/* Image preview in card */
.image-card-preview {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 6px 6px 0 0;
}

/* Card content */
.image-card-content {
    padding: 8px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.image-card-filename {
    font-size: 10px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 5px;
}

.image-card-actions {
    display: flex;
    gap: 5px;
    justify-content: space-between;
    align-items: center;
}

.image-card-order {
    background: #007bff;
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
}

.image-card-order.primary {
    background: #28a745;
}

.image-card-remove {
    background: #dc3545;
    color: white;
    border: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.image-card-remove:hover {
    background: #c82333;
}

/* Drag handle for cards */
.image-card-drag-handle {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0,0,0,0.7);
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: grab;
}

.image-card:hover .image-card-drag-handle {
    opacity: 1;
}

.image-card-drag-handle:active {
    cursor: grabbing;
}

/* Cover indicator */
.image-card.cover::before {
    content: "COVER";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    font-size: 8px;
    font-weight: bold;
    text-align: center;
    padding: 2px;
    z-index: 10;
}

/* Hidden input for file path */
.image-card-input {
    display: none;
}

/* File input for upload */
.image-card-file-input {
    display: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 10px;
        padding: 15px;
    }
    
    .image-card-preview {
        height: 60px;
    }
    
    .image-card-content {
        padding: 6px;
    }
    
    .image-card-drag-handle {
        opacity: 1;
        background: rgba(0,123,255,0.8);
    }
}

@media (max-width: 480px) {
    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 8px;
        padding: 10px;
    }
    
    .image-card-preview {
        height: 50px;
    }
}
/* Preview order during drag */
.drag-preview {
    position: fixed;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 12px;
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.drag-preview.show {
    opacity: 1;
}

.drag-preview i {
    margin-right: 5px;
    color: #ffc107;
}

/* Improved mobile drag handle */
@media (max-width: 768px) {
    .drag-handle {
        background: #007bff;
        border-radius: 6px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    }
    
    .drag-handle:active {
        background: #0056b3;
        transform: scale(0.95);
    }
}

/* Animation for successful reorder */
@keyframes reorderSuccess {
    0% { background: #d4edda; }
    100% { background: transparent; }
}

.image-input-row.reorder-success {
    animation: reorderSuccess 1s ease;
}