/**
 * MyLog Enhanced User Form Styles
 * Version: 3.0.0
 * Optimized for: Lean vertical spacing, mobile-first, accessibility
 */

/* Form Container */
.mylog-form-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 0;
}

.mylog-form--lean {
    display: flex;
    flex-direction: column;
    gap: 1rem; /* Reduced from typical 1.5-2rem */
}

/* Form Groups - Lean Spacing */
.mylog-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem; /* Tight label-to-input spacing */
}

/* Labels */
.mylog-label {
    font-size: 0.9375rem; /* 15px */
    font-weight: 600;
    color: #1a1a1a;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    line-height: 1.3;
}

.mylog-label--required::after {
    content: '*';
    color: #d32f2f;
    margin-left: 0.25rem;
}

/* Traffic Light Indicators */
.mylog-traffic-light {
    font-size: 1.25rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}

.mylog-traffic-light--green {
    color: #2e7d32;
}

.mylog-traffic-light--red {
    color: #d32f2f;
}

/* Help Text - Compact */
.mylog-help-text {
    font-size: 0.8125rem; /* 13px */
    color: #666;
    font-style: italic;
    margin: 0;
    line-height: 1.3;
}

/* Input Fields */
.mylog-input,
.mylog-textarea,
.mylog-select {
    width: 100%;
    padding: 0.625rem 0.75rem; /* Reduced from 0.75rem 1rem */
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
}

.mylog-input:focus,
.mylog-textarea:focus,
.mylog-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.mylog-textarea {
    resize: vertical;
    min-height: 4rem; /* Reduced from 5rem */
    line-height: 1.5;
}

.mylog-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.25rem;
    padding-right: 2.5rem;
}

/* Photo Upload Section */
.mylog-form-group--photo {
    gap: 0.625rem;
}

.mylog-photo-upload {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.mylog-photo-preview {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 2px solid #e5e7eb;
}

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

.mylog-photo-placeholder {
    color: #9ca3af;
    display: flex;
}

.mylog-photo-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

/* Buttons */
.mylog-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    font-family: inherit;
    line-height: 1.4;
}

.mylog-btn--primary {
    background: #3b82f6;
    color: white;
}

.mylog-btn--primary:hover {
    background: #2563eb;
}

.mylog-btn--primary:active {
    background: #1d4ed8;
}

.mylog-btn--secondary {
    background: #3b82f6;
    color: white;
    border: 1px solid #3b82f6;
}

.mylog-btn--secondary:hover {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

.mylog-btn--text {
    background: transparent;
    color: #ef4444;
    padding: 0.5rem 0.75rem;
}

.mylog-btn--text:hover {
    background: #fef2f2;
}

.mylog-btn--block {
    width: 100%;
}

.mylog-btn svg {
    flex-shrink: 0;
}

.mylog-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Loading State */
.mylog-btn-loading {
    display: none;
}

.mylog-btn.is-loading .mylog-btn-text {
    display: none;
}

.mylog-btn.is-loading .mylog-btn-loading {
    display: flex;
}

.mylog-spinner {
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Form Actions */
.mylog-form-actions {
    margin-top: 0.5rem; /* Reduced from 1.5rem */
}

/* Response Messages */
.mylog-form-response {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.9375rem;
}

.mylog-form-response.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.mylog-form-response.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* Notices */
.mylog-notice {
    padding: 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid;
}

.mylog-notice--warning {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #78350f;
}

.mylog-notice p {
    margin: 0;
    line-height: 1.5;
}

.mylog-notice p + p {
    margin-top: 0.5rem;
}

.mylog-notice a {
    color: inherit;
    text-decoration: underline;
    font-weight: 600;
}

/* User Details Modal */
.mylog-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 1rem;
}

.mylog-modal.is-active {
    display: flex;
}

.mylog-modal-content {
    background: white;
    border-radius: 0.5rem;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 1.5rem;
    position: relative;
}

.mylog-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.mylog-modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.mylog-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6b7280;
    padding: 0.25rem;
    line-height: 1;
}

.mylog-modal-close:hover {
    color: #374151;
}

.mylog-modal-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.mylog-user-detail {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.mylog-user-detail-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.mylog-user-detail-value {
    font-size: 1rem;
    color: #1a1a1a;
    line-height: 1.5;
}

.mylog-user-detail-value:empty::before {
    content: '—';
    color: #9ca3af;
}

.mylog-user-photo-large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #e5e7eb;
}

/* Manage Users Page Enhancements */
.mylog-users-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.mylog-users-table th,
.mylog-users-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.mylog-users-table th {
    background: #f9fafb;
    font-weight: 600;
    font-size: 0.875rem;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.mylog-users-table td {
    font-size: 0.9375rem;
}

.mylog-users-table tr:hover {
    background: #f9fafb;
}

.mylog-table-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.mylog-btn--small {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 640px) {
    .mylog-form-container {
        padding: 0 1rem;
    }
    
    .mylog-photo-upload {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .mylog-photo-actions {
        width: 100%;
    }
    
    .mylog-users-table {
        font-size: 0.875rem;
    }
    
    .mylog-users-table th,
    .mylog-users-table td {
        padding: 0.5rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .mylog-input,
    .mylog-textarea,
    .mylog-select {
        border-width: 2px;
    }
    
    .mylog-btn--primary {
        border: 2px solid currentColor;
    }
}