/* admin.css - Upgraded to match Property by Fridah Theme */

/* ===== ROOT VARIABLES ===== */
:root {
    --primary-color: #28a745;
    --primary-hover: #218838;
    --secondary-color: #6c757d;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --success-color: #28a745;
    --info-color: #17a2b8;
    --dark-color: #343a40;
    --light-color: #f8f9fa;
    --border-color: #dee2e6;
    --shadow-light: 0 2px 10px rgba(0, 0, 0, 0.05);
    --shadow-medium: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-dark: 0 6px 30px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

/* ===== BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Jost', sans-serif;
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

/* ===== HEADER ===== */
.admin-header {
    background: linear-gradient(135deg, var(--dark-color) 0%, #1f2937 100%);
    color: white;
    padding: 1.5rem 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.admin-header .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.admin-header h1 i {
    color: var(--primary-color);
    margin-right: 10px;
}

.header-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

/* ===== MAIN CONTAINER ===== */
.admin-container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}

/* ===== LOGIN SECTION ===== */
#loginSection {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70vh;
}

.login-card {
    background: white;
    padding: 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-dark);
    width: 100%;
    max-width: 450px;
    border-top: 4px solid var(--primary-color);
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-card h2 {
    color: var(--dark-color);
    margin-bottom: 2rem;
    text-align: center;
    font-weight: 600;
}

.login-card h2 i {
    color: var(--primary-color);
    margin-right: 10px;
}

/* ===== ADMIN SECTION ===== */
#adminSection {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ===== FORM STYLES ===== */
.form-header {
    background: white;
    padding: 1.5rem 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--primary-color);
}

.form-header h2 {
    color: var(--dark-color);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-header h2 i {
    color: var(--primary-color);
}

/* Form Status Messages */
#formStatus {
    background: #d1ecf1;
    color: #0c5460;
    padding: 15px;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--info-color);
    margin-bottom: 1.5rem;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

#formStatus.success {
    background: #d4edda;
    color: #155724;
    border-left-color: var(--success-color);
}

#formStatus.error {
    background: #f8d7da;
    color: #721c24;
    border-left-color: var(--danger-color);
}

#formStatus.warning {
    background: #fff3cd;
    color: #856404;
    border-left-color: var(--warning-color);
}

/* Form Card */
#propertyForm {
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-medium);
    margin-bottom: 2.5rem;
}

/* Form Layout */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #495057;
    font-size: 15px;
}

.form-group label.required::after {
    content: " *";
    color: var(--danger-color);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 15px;
    font-family: 'Jost', sans-serif;
    transition: var(--transition);
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

.form-control:hover {
    border-color: #adb5bd;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 15px center;
    background-repeat: no-repeat;
    background-size: 16px 16px;
    padding-right: 40px;
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
    line-height: 1.5;
}

/* Transaction Type Buttons */
.transaction-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.transaction-btn {
    flex: 1;
    min-width: 120px;
    padding: 12px 20px;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Jost', sans-serif;
    font-weight: 500;
    color: #495057;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.transaction-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
}

.transaction-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.2);
}

/* Features Management */
.features-input {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.features-input input {
    flex: 1;
}

.features-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 40px;
    padding: 10px;
    border: 1px dashed var(--border-color);
    border-radius: 6px;
    background: var(--light-color);
}

.feature-tag {
    background: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-color);
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.feature-tag .remove-feature {
    background: none;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    font-size: 16px;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.feature-tag .remove-feature:hover {
    background: var(--danger-color);
    color: white;
}

/* Image Previews */
.image-preview-container {
    margin: 15px 0;
    padding: 20px;
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    background: var(--light-color);
    min-height: 150px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    justify-content: center;
}

.image-preview-container.empty {
    justify-content: center;
}

.image-preview-container.empty p {
    color: #6c757d;
    font-style: italic;
}

.preview-image {
    position: relative;
    border: 3px solid white;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: var(--shadow-medium);
    width: 140px;
    height: 160px;
    transition: var(--transition);
}

.preview-image:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-dark);
}

.preview-image img {
    width: 100%;
    height: 110px;
    object-fit: cover;
    display: block;
    background: #f8f9fa;
}

.preview-image .image-name {
    display: block;
    font-size: 12px;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-image .image-size {
    display: block;
    font-size: 11px;
    color: #6c757d;
    padding: 4px 8px;
    background: #e9ecef;
}

.preview-image.existing {
    border-color: var(--primary-color);
}

.preview-image.existing .image-index {
    display: block;
    font-size: 12px;
    padding: 6px 8px;
    background: var(--primary-color);
    color: white;
    text-align: center;
    font-weight: 500;
}

.remove-existing-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: var(--transition);
    opacity: 0;
}

.preview-image:hover .remove-existing-btn {
    opacity: 1;
}

.remove-existing-btn:hover {
    background: #c82333;
    transform: scale(1.1);
}

.existing-images-notice {
    background: #e7f5ff;
    padding: 12px 16px;
    border-radius: 6px;
    margin: 10px 0;
    font-size: 14px;
    color: #055160;
    border-left: 4px solid var(--info-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.existing-images-notice i {
    color: var(--info-color);
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

/* ===== BUTTON STYLES ===== */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Jost', sans-serif;
    font-size: 15px;
    font-weight: 500;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 120px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.2);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(40, 167, 69, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.2);
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(220, 53, 69, 0.3);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    min-width: auto;
}

/* ===== PROPERTIES TABLE ===== */
.table-container {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-medium);
    overflow: hidden;
    margin-top: 2rem;
}

.table-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-header h3 {
    color: var(--dark-color);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-header h3 i {
    color: var(--primary-color);
}

.table-wrapper {
    overflow-x: auto;
}

#propertiesTable {
    width: 100%;
    border-collapse: collapse;
    min-width: 1000px;
}

#propertiesTable thead {
    background: var(--light-color);
    border-bottom: 2px solid var(--border-color);
}

#propertiesTable th {
    padding: 16px 20px;
    text-align: left;
    font-weight: 600;
    color: var(--dark-color);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

#propertiesTable tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

#propertiesTable tbody tr:hover {
    background: rgba(40, 167, 69, 0.05);
}

#propertiesTable td {
    padding: 16px 20px;
    color: #495057;
    font-size: 15px;
    vertical-align: middle;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 90px;
    text-align: center;
}

.status-badge.available {
    background: rgba(40, 167, 69, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(40, 167, 69, 0.2);
}

.status-badge.sold {
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
    border: 1px solid rgba(220, 53, 69, 0.2);
}

.status-badge.reserved {
    background: rgba(255, 193, 7, 0.1);
    color: #856404;
    border: 1px solid rgba(255, 193, 7, 0.2);
}

/* Table Actions */
.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Image Count */
.image-count {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: rgba(23, 162, 184, 0.1);
    color: var(--info-color);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.image-count i {
    font-size: 14px;
}

/* Transaction Badge */
.transaction-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    background: rgba(108, 117, 125, 0.1);
    color: var(--secondary-color);
}

/* ===== LOADING STATES ===== */
.loading-row {
    text-align: center;
    padding: 40px !important;
}

.loading-row td {
    color: #6c757d;
    font-style: italic;
}

.loading-row i {
    color: var(--primary-color);
    margin-right: 10px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== FOOTER ===== */
.admin-footer {
    margin-top: 3rem;
    padding: 2rem 0;
    text-align: center;
    color: #6c757d;
    font-size: 14px;
    border-top: 1px solid var(--border-color);
}

.admin-footer a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

.admin-footer a:hover {
    text-decoration: underline;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .admin-container {
        padding: 0 15px;
        margin: 20px auto;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .transaction-group {
        flex-direction: column;
    }
    
    .transaction-btn {
        min-width: 100%;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        min-width: auto;
    }
    
    .table-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .preview-image {
        width: 120px;
        height: 140px;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 1.5rem;
    }
    
    #propertyForm {
        padding: 1.5rem;
    }
    
    .form-header {
        padding: 1rem 1.5rem;
    }
    
    .actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .actions .btn {
        width: 100%;
        margin-bottom: 5px;
    }
    
    .preview-image {
        width: 100px;
        height: 120px;
    }
    
    .features-input {
        flex-direction: column;
    }
}

/* Print Styles */
@media print {
    #loginSection,
    .form-actions,
    .actions {
        display: none !important;
    }
    
    .admin-header {
        box-shadow: none;
        border-bottom: 2px solid #000;
    }
    
    #propertyForm,
    .table-container {
        box-shadow: none;
        border: 1px solid #000;
    }
}

/* Modal styles */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.9);
  align-items: center;
  justify-content: center;
}

.modal.show {
  display: flex;
}

.modal-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  background: transparent;
}

.modal-body {
  display: flex;
  justify-content: center;
  align-items: center;
}

#modalImage {
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.modal-close {
  position: absolute;
  top: -40px;
  right: 0;
  color: white;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  transition: 0.3s;
  line-height: 1;
}

.modal-close:hover {
  color: #28a745;
}

.modal-prev, .modal-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.5);
  color: white;
  border: none;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  transition: 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-prev:hover, .modal-next:hover {
  background: rgba(40, 167, 69, 0.8);
}

.modal-prev {
  left: 20px;
}

.modal-next {
  right: 20px;
}

.modal-caption {
  position: absolute;
  bottom: -40px;
  left: 0;
  width: 100%;
  text-align: center;
  color: white;
  font-size: 16px;
}

@media (max-width: 768px) {
  .modal-prev, .modal-next {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
  
  .modal-prev {
    left: 10px;
  }
  
  .modal-next {
    right: 10px;
  }
}

.remove-selected-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #dc3545;
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  z-index: 10;
  transition: all 0.2s;
}

.remove-selected-btn:hover {
  background: #c82333;
  transform: scale(1.1);
}

/* Reorder buttons */
.reorder-buttons {
  position: absolute;
  bottom: 30px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 8px;
  background: rgba(0,0,0,0.5);
  padding: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}

.preview-image:hover .reorder-buttons {
  opacity: 1;
}

.reorder-btn {
  background: white;
  border: none;
  border-radius: 4px;
  width: 24px;
  height: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #333;
}

.reorder-btn:hover {
  background: #28a745;
  color: white;
}

.reorder-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Make reorder buttons bigger and easier to tap on mobile */
.reorder-btn {
  width: 44px !important;        /* Minimum tap target size */
  height: 44px !important;
  border-radius: 12px !important;
  font-size: 20px !important;
  background: #2d3e50;
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 2px;
}

.reorder-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  padding: 8px;
  background: rgba(0,0,0,0.05);
  border-radius: 0 0 8px 8px;
}

/* Visual feedback on tap */
.reorder-btn:active {
  transform: scale(0.95);
  background: #1a2a3a;
}

/* Disabled buttons appear lighter */
.reorder-btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}
@media (max-width:768px){
  .preview-image{
    width:140px;
    height:160px;
  }
}
.pagination-btn {
  padding: 6px 12px;
  border: 1px solid #ddd;
  background: white;
  border-radius: 4px;
  cursor: pointer;
  transition: 0.2s;
}
.pagination-btn:hover {
  border-color: #28a745;
  color: #28a745;
}
.pagination-btn.active {
  background: #28a745;
  color: white;
  border-color: #28a745;
}