/* Homie Property Management - Main CSS */

/* CSS Variables (Design System) - Matches base.html */
:root {
    /* Primary Colors from specification */
    --primary-teal: #175560;
    --secondary-sage: #609e7c;
    --accent-mint: #39b496;

    /* Additional colors for UI */
    --primary-dark: #0f3a42;
    --secondary-dark: #4a7a5f;

    /* Neutral Colors */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Status Colors */
    --success: #059669;
    --warning: #d97706;
    --error: #dc2626;
    --info: #0891b2;
}

/* Base Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--gray-900);
    background-color: var(--gray-50);
}

/* Button System */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    font-family: inherit;
    min-height: 38px;
}

.btn-small {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    min-height: 32px;
}

.btn-primary {
    background-color: var(--primary-teal);
    color: white;
    border-color: var(--primary-teal);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    color: white;
    text-decoration: none;
}

.btn-secondary {
    background-color: var(--gray-200);
    color: var(--gray-700);
    border-color: var(--gray-200);
}

.btn-secondary:hover {
    background-color: var(--gray-300);
    border-color: var(--gray-300);
    color: var(--gray-800);
    text-decoration: none;
}

/* Action Button Groups */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.action-buttons .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    line-height: 1;
}

.action-buttons form {
    display: flex;
    margin: 0;
}

/* Specific Action Groups */
.expense-actions,
.payment-actions {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.expense-actions .btn,
.payment-actions .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    font-family: inherit;
    font-size: 0.875rem;
    line-height: 1;
}

.expense-actions form,
.payment-actions form {
    display: flex;
    margin: 0;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
}

th {
    text-align: left;
    padding: 1rem;
    font-weight: 600;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background-color: var(--gray-50);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover {
    background-color: var(--gray-50);
}

/* Card Styles */
.card {
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.summary-card {
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    text-align: center;
}

.summary-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-teal);
    margin-bottom: 0.5rem;
}

.summary-label {
    font-size: 0.875rem;
    color: var(--gray-600);
}

/* Header Styles */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-title h1 {
    margin-bottom: 0.5rem;
    color: var(--gray-900);
    text-transform: capitalize;
}

.property-name,
.page-subtitle {
    color: var(--gray-600);
    font-size: 1.125rem;
    text-transform: capitalize;
}

/* Property and Unit Name Capitalization */
.property-title,
.unit-title,
.property-card h3,
.property-card .property-name {
    text-transform: capitalize;
}

/* Context values (like property names in unit details) */
.context-value {
    text-transform: capitalize;
}

/* Table content capitalization */
.property-name-cell,
.unit-name-cell {
    text-transform: capitalize;
}

/* Breadcrumb and navigation capitalization */
.breadcrumb .property-name,
.breadcrumb .unit-name,
.nav-property-name,
.nav-unit-name {
    text-transform: capitalize;
}

/* Form labels and display text */
.property-display-name,
.unit-display-name {
    text-transform: capitalize;
}

/* Status Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success {
    background-color: var(--accent-mint);
    color: white;
}

.badge-error {
    background-color: var(--error);
    color: white;
}

.badge-warning {
    background-color: var(--warning);
    color: white;
}

.badge-shared {
    background-color: var(--primary-teal);
    color: white;
}

.badge-share-count {
    background-color: var(--accent-mint);
    color: var(--gray-800);
}

/* Payment/Expense specific badges */
.payment-late {
    background-color: var(--error);
    color: white;
}

.payment-ontime {
    background-color: var(--accent-mint);
    color: white;
}

.late-fee {
    color: var(--error);
    font-weight: 500;
}

/* Category badges for expenses */
.category-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    background-color: var(--gray-200);
    color: var(--gray-700);
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--gray-500);
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--gray-700);
}

/* Form Styles */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--gray-700);
}

.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    line-height: 1.25;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Property Image Styles
 *
 * Usage:
 * 1. For main property detail images: .property-image-container.aspect-16-9
 * 2. For property card images: .property-card-image-container
 * 3. Both support responsive design and fallbacks for older browsers
 * 4. Images use object-fit: cover to maintain aspect ratio without distortion
 * 5. Placeholders are shown when no image is available
 */
.property-image-container {
    position: relative;
    width: 100%;
    margin-bottom: 2rem;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* 16:9 Aspect Ratio (recommended for property photos) */
.property-image-container.aspect-16-9 {
    aspect-ratio: 16 / 9;
}

/* 4:3 Aspect Ratio (alternative option) */
.property-image-container.aspect-4-3 {
    aspect-ratio: 4 / 3;
}

/* Flexible height option - maintains width but allows natural height */
.property-image-container.flexible {
    aspect-ratio: unset;
    max-height: 400px;
    min-height: 200px;
}

.property-image-container.flexible .property-image {
    position: static;
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: contain;
    background-color: var(--gray-50);
}

.property-image-container.flexible .property-image-placeholder {
    position: static;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--gray-100) 0%, var(--gray-200) 100%);
    color: var(--gray-400);
    font-size: 4rem;
}

/* Fallback for browsers that don't support aspect-ratio */
.property-image-container.aspect-16-9::before {
    content: '';
    display: block;
    padding-top: 56.25%; /* 16:9 = 9/16 = 0.5625 = 56.25% */
}

.property-image-container.aspect-4-3::before {
    content: '';
    display: block;
    padding-top: 75%; /* 4:3 = 3/4 = 0.75 = 75% */
}

/* Hide the pseudo-element when aspect-ratio is supported */
@supports (aspect-ratio: 16 / 9) {
    .property-image-container::before {
        display: none;
    }
}

.property-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    transition: transform 0.3s ease;
}

/* Alternative object-fit options for better image display */
.property-image.contain {
    object-fit: contain;
    background-color: var(--gray-100);
}

.property-image.cover-top {
    object-position: center top;
}

.property-image.cover-bottom {
    object-position: center bottom;
}

/* Hover effect for property images */
.property-image:hover {
    transform: scale(1.02);
}

/* Placeholder for properties without images */
.property-image-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--gray-100) 0%, var(--gray-200) 100%);
    color: var(--gray-400);
    font-size: 4rem;
}

/* Property image overlay (for future use - property status, badges, etc.) */
.property-image-overlay {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10;
}

/* Responsive adjustments for property images */
@media (max-width: 768px) {
    .property-image-container {
        margin-bottom: 1.5rem;
        border-radius: 0.375rem;
    }

    .property-image-placeholder {
        font-size: 3rem;
    }
}

@media (max-width: 480px) {
    .property-image-placeholder {
        font-size: 2.5rem;
    }
}

/* Property Card Images (for property list/grid views) */
.property-card-image-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 0.5rem 0.5rem 0 0;
    overflow: hidden;
    background: linear-gradient(135deg, var(--gray-100) 0%, var(--gray-200) 100%);
}

/* Fallback for browsers that don't support aspect-ratio */
.property-card-image-container::before {
    content: '';
    display: block;
    padding-top: 56.25%; /* 16:9 aspect ratio */
}

@supports (aspect-ratio: 16 / 9) {
    .property-card-image-container::before {
        display: none;
    }
}

.property-card-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
}

.property-card-image:hover {
    transform: scale(1.05);
}

.property-card-image-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-400);
    font-size: 3rem;
}

@media (max-width: 768px) {
    .property-card-image-placeholder {
        font-size: 2.5rem;
    }
}

@media (max-width: 480px) {
    .property-card-image-placeholder {
        font-size: 2rem;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .action-buttons,
    .expense-actions,
    .payment-actions {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .table-wrapper {
        overflow-x: auto;
    }
    
    table {
        min-width: 600px;
    }
    
    .summary-cards {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .btn {
        width: 100%;
        justify-content: center;
    }

    .action-buttons .btn {
        width: auto;
    }
}

/* File Input Customization for Translation */
input[type="file"] {
    position: relative;
}

/* Custom file input styling to show translated text */
.file-input-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.file-input-wrapper input[type="file"] {
    opacity: 0;
    position: absolute;
    z-index: -1;
}

.file-input-wrapper .file-input-button {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: var(--gray-100);
    border: 1px solid var(--gray-300);
    border-radius: 0.375rem;
    cursor: pointer;
    color: var(--gray-700);
    font-size: 0.875rem;
    transition: background-color 0.2s;
}

.file-input-wrapper .file-input-button:hover {
    background-color: var(--gray-200);
}

.file-input-wrapper .file-name {
    margin-left: 0.5rem;
    color: var(--gray-600);
    font-size: 0.875rem;
}

/* Submit button translations */
input[type="submit"][value="Update property"] {
    background-color: var(--primary-teal);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
}

input[type="submit"][value="Update property"]:hover {
    background-color: var(--primary-dark);
}
