/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 10px;
    color: #333;
}

.app-container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    min-height: calc(100vh - 20px);
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: none;
}

.app-header.active {
    display: block;
}

.app-header h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 5px;
}

.header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.breadcrumb {
    font-size: 14px;
    opacity: 0.9;
    flex: 1;
}

.btn-logout {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* View Management */
.view {
    display: none;
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.view.active {
    display: block;
}

/* Buttons */
.btn {
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    display: inline-block;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

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

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

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

.btn-camera {
    background: #28a745;
    color: white;
    width: 100%;
}

.btn-camera:hover {
    background: #218838;
}

.btn-gps {
    background: #17a2b8;
    color: white;
    width: 100%;
}

.btn-gps:hover {
    background: #138496;
}

.btn-gps:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.btn-large {
    width: 100%;
    padding: 15px;
    font-size: 18px;
    margin-top: 10px;
}

/* View Header */
.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.view-header h2 {
    font-size: 24px;
    color: #333;
    margin: 0;
}

/* Main View - Add Location Button */
.add-location-btn-container {
    margin-bottom: 20px;
}

#addLocationBtn {
    width: 100%;
    font-size: 18px;
    padding: 15px;
}

/* Locations List */
.locations-list {
    display: grid;
    gap: 15px;
}

.location-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    gap: 15px;
}

.location-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
}

.location-card-image {
    width: 100px;
    height: 100px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
}

.location-card-content {
    flex: 1;
    min-width: 0;
}

.location-card-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.location-card-equipment {
    display: inline-block;
    background: #667eea;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 5px;
}

.location-card-notes {
    font-size: 14px;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.location-card-date {
    font-size: 12px;
    color: #999;
    margin-top: 5px;
}

/* Empty State */
.empty-state {
    display: none;
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state.active {
    display: block;
}

.empty-icon {
    font-size: 80px;
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 24px;
    margin-bottom: 10px;
    color: #666;
}

.empty-state p {
    font-size: 16px;
    line-height: 1.6;
}

/* Form View */
.form-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.form-header h2 {
    flex: 1;
    font-size: 24px;
    color: #333;
}

.location-form {
    max-width: 600px;
    margin: 0 auto;
}

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

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

.form-input,
.form-textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

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

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

/* Device Management */
.devices-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
    min-height: 40px;
}

.device-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
}

.device-item-text {
    flex: 1;
    font-weight: 500;
    color: #333;
}

.device-item-remove {
    padding: 4px 12px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    font-weight: 600;
}

.device-item-remove:hover {
    background: #c82333;
}

.device-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Toggle Switch Container */
.toggle-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toggle-label {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #667eea;
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #764ba2;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 2px #764ba2;
}

/* Camera Section */
.camera-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* GPS Section */
.gps-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.gps-display {
    display: none;
    background: #f8f9fa;
    border: 2px solid #17a2b8;
    border-radius: 8px;
    padding: 12px;
    margin-top: 10px;
}

.gps-display.active {
    display: block;
}

.gps-coords {
    font-size: 14px;
    color: #333;
    margin-bottom: 8px;
}

.gps-coords strong {
    color: #17a2b8;
}

.gps-accuracy {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}

.gps-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.gps-link {
    display: inline-block;
    padding: 6px 12px;
    background: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.gps-link:hover {
    background: #5568d3;
}

.gps-remove-btn {
    padding: 6px 12px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

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

.gps-loading {
    color: #17a2b8;
    font-size: 14px;
    text-align: center;
    padding: 10px;
}

.gps-error {
    color: #dc3545;
    font-size: 14px;
    text-align: center;
    padding: 10px;
    background: #f8d7da;
    border-radius: 6px;
}

.photo-preview {
    display: none;
    margin-top: 10px;
}

.photo-preview.active {
    display: block;
}

.photo-preview img {
    width: 100%;
    max-height: 300px;
    object-fit: contain;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
}

.photo-remove-btn {
    margin-top: 10px;
    background: #dc3545;
    color: white;
    padding: 8px 15px;
    border-radius: 6px;
    font-size: 14px;
}

/* Form Actions */
.form-actions {
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Detail View */
.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
    flex-wrap: wrap;
    gap: 10px;
}

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

.detail-content {
    max-width: 700px;
    margin: 0 auto;
}

.detail-image {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: 12px;
    margin-bottom: 25px;
    border: 2px solid #e0e0e0;
}

.detail-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.detail-section:last-child {
    border-bottom: none;
}

.detail-label {
    font-size: 12px;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.detail-value {
    font-size: 16px;
    color: #333;
    line-height: 1.6;
    white-space: pre-wrap;
}

.detail-title {
    font-size: 28px;
    font-weight: 700;
    color: #333;
    margin-bottom: 15px;
}

.detail-equipment-badge {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 20px;
}

.detail-date {
    font-size: 14px;
    color: #999;
    margin-bottom: 25px;
}

/* Property Cards */
.properties-list {
    display: grid;
    gap: 15px;
}

.property-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.property-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
}

.property-card-name {
    font-size: 20px;
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
}

.property-card-address {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

.property-card-stats {
    display: flex;
    gap: 15px;
    margin-top: 12px;
}

.property-stat {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    color: #667eea;
    font-weight: 600;
}

/* Tabs */
.property-tabs {
    display: flex;
    gap: 10px;
    margin: 25px 0;
    padding: 0 20px;
    border-bottom: 2px solid #e0e0e0;
    overflow-x: auto;
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.tab-btn:hover {
    color: #667eea;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.tab-content {
    display: none;
    padding: 20px;
}

.tab-content.active {
    display: block;
}

/* Inventory */
.inventory-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.inventory-header h3 {
    font-size: 20px;
    color: #333;
}

.inventory-content {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
}

.inventory-item {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.inventory-item-name {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.inventory-item-quantity {
    background: #667eea;
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 700;
}

.inventory-empty {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

/* Summary */
.summary-header {
    margin-bottom: 20px;
}

.summary-header h3 {
    font-size: 20px;
    color: #333;
    margin-bottom: 15px;
}

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

.summary-content {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 25px;
    line-height: 1.8;
    color: #333;
}

.summary-content h4 {
    color: #667eea;
    margin: 20px 0 10px 0;
    font-size: 18px;
}

.summary-content ul {
    margin: 10px 0;
    padding-left: 25px;
}

.summary-content li {
    margin: 8px 0;
}

.summary-loading {
    text-align: center;
    padding: 40px;
    color: #667eea;
}

.summary-loading::after {
    content: '...';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.modal-header h2 {
    font-size: 22px;
    color: #333;
}

.btn-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    line-height: 1;
}

.btn-close:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

.share-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-block {
    width: 100%;
    text-align: left;
    justify-content: flex-start;
}

/* Login View */
.login-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 40px 20px;
    text-align: center;
}

.login-logo {
    font-size: 80px;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.login-container h1 {
    font-size: 28px;
    color: #333;
    margin-bottom: 10px;
}

.login-subtitle {
    color: #666;
    margin-bottom: 40px;
    font-size: 16px;
}

.login-form {
    text-align: left;
    margin-bottom: 30px;
}

.login-error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 14px;
    display: none;
}

.login-error.active {
    display: block;
}

.login-info {
    background: #e7f3ff;
    border: 1px solid #b3d9ff;
    border-radius: 8px;
    padding: 20px;
    text-align: left;
}

.login-info p {
    margin: 8px 0;
    font-size: 14px;
    color: #0066cc;
}

.login-info strong {
    color: #004999;
}

.code-info {
    font-size: 10px;
    color: #666;
    margin-top: 8px;
    text-align: center;
}

.code-info strong {
    font-size: 10px;
}

.code-display {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
    text-align: center;
    display: none;
}

.code-display.active {
    display: block;
}

.code-display strong {
    font-size: 32px;
    color: #333;
    letter-spacing: 8px;
    font-family: 'Courier New', monospace;
}

.code-display p {
    margin: 5px 0;
    font-size: 14px;
    color: #856404;
}

.code-display-title {
    font-weight: 600;
    margin-bottom: 10px;
    color: #856404;
}

/* Responsive Design */
@media (max-width: 600px) {
    body {
        padding: 0;
    }

    .app-container {
        border-radius: 0;
        min-height: 100vh;
    }

    .app-header h1 {
        font-size: 20px;
    }

    .location-card {
        flex-direction: column;
    }

    .location-card-image {
        width: 100%;
        height: 200px;
    }

    .detail-actions {
        width: 100%;
    }

    .detail-actions .btn {
        flex: 1;
    }

    .property-tabs {
        padding: 0 10px;
    }

    .tab-btn {
        padding: 10px 12px;
        font-size: 14px;
    }
}

/* Loading/Saving States */
.saving {
    opacity: 0.6;
    pointer-events: none;
}

/* Success/Error Messages */
.message {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 600;
}

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

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