/**
 * Asset Tracking Plugin - Frontend Styles
 * 
 * @package AssetTracking
 * @version 1.0.0
 * @author Andi Sharil
 */

/* Reset and Base Styles */
.at-frontend-container,
.at-scanner-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #374151;
}

.at-frontend-container *,
.at-scanner-container * {
    box-sizing: border-box;
}

/* Layout */
.at-frontend-container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.at-scanner-container {
    max-width: 600px;
    margin: 1rem auto;
    padding: 0 1rem;
}

.at-track-asset,
.at-scanner-app {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Headers */
.at-asset-header,
.at-scanner-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
    padding: 2rem;
    color: white;
    border-radius: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.at-asset-header {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.at-scanner-header {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

.at-asset-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex: 1;
}

.at-asset-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 4rem;
    height: 4rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 1rem;
}

.at-asset-name {
    margin: 0 0 0.5rem 0;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
}

.at-asset-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.875rem;
    opacity: 0.9;
}

.at-asset-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.at-asset-status {
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.2);
}

.at-current-location {
    text-align: right;
    min-width: 200px;
}

.at-location-label {
    font-size: 0.875rem;
    opacity: 0.8;
    margin-bottom: 0.5rem;
}

.at-location-name {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.at-last-scan {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.25rem;
    font-size: 0.75rem;
    opacity: 0.8;
}

/* Scanner Header */
.at-scanner-title h1 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0 0 0.5rem 0;
    font-size: 1.75rem;
    font-weight: 700;
}

.at-scanner-title p {
    margin: 0;
    opacity: 0.9;
    font-size: 1rem;
}

.at-scanner-actions {
    display: flex;
    gap: 0.75rem;
    flex-shrink: 0;
}

/* Cards */
.at-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.at-card-header {
    padding: 1.5rem 1.5rem 0 1.5rem;
}

.at-card-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
}

.at-card-content {
    padding: 1.5rem;
}

/* Forms */
.at-form-group {
    margin-bottom: 1.5rem;
}

.at-form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
}

.at-required {
    color: #dc2626;
}

.at-form-input,
.at-form-select,
.at-form-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

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

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

/* Input Groups */
.at-input-group {
    display: flex;
    gap: 0.5rem;
}

.at-input-group .at-form-input {
    flex: 1;
}

/* Geolocation Section */
.at-geolocation-section {
    padding: 1.5rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
}

.at-geolocation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.at-coordinates-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.at-location-status {
    min-height: 1.5rem;
}

.at-location-message {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.at-location-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.at-location-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Buttons */
.at-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: 1px solid transparent;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

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

.at-btn-primary:hover {
    background: #2563eb;
    color: white;
    text-decoration: none;
}

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

.at-btn-secondary:hover {
    background: #4b5563;
    color: white;
    text-decoration: none;
}

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

.at-btn-danger:hover {
    background: #b91c1c;
    color: white;
    text-decoration: none;
}

.at-btn-ghost {
    background: transparent;
    color: #6b7280;
    border-color: #d1d5db;
}

.at-btn-ghost:hover {
    background: #f9fafb;
    color: #374151;
    text-decoration: none;
}

.at-btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
}

.at-btn-lg {
    padding: 1rem 2rem;
    font-size: 1rem;
}

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

/* Form Actions */
.at-form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #e5e7eb;
}

/* Info Grid */
.at-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.at-info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.at-info-item label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
}

.at-info-item span {
    font-weight: 500;
    color: #111827;
}

.at-serial {
    font-family: monospace;
    background: #f3f4f6;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
}

.at-value {
    color: #059669;
    font-weight: 600;
}

/* Activity List */
.at-activity-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.at-activity-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 0.5rem;
    border-left: 4px solid #3b82f6;
}

.at-activity-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    background: #3b82f6;
    color: white;
    border-radius: 50%;
    flex-shrink: 0;
}

.at-activity-content {
    flex: 1;
}

.at-activity-title {
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.5rem;
}

.at-activity-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.at-activity-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.at-activity-notes {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #6b7280;
    font-style: italic;
}

/* Alerts */
.at-alert {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
}

.at-alert-success {
    background: #d1fae5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.at-alert-error {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.at-alert-icon {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.at-alert-content {
    flex: 1;
}

.at-alert-message {
    margin: 0;
    font-weight: 500;
}

/* Camera Container */
.at-camera-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    border-radius: 1rem;
    overflow: hidden;
    background: #000;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

#camera-preview {
    width: 100%;
    height: auto;
    min-height: 300px;
    object-fit: cover;
    display: block;
}

.at-scanner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.at-scanner-frame {
    position: relative;
    width: 250px;
    height: 250px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 1rem;
}

.at-scanner-corners {
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
}

.at-corner {
    position: absolute;
    width: 30px;
    height: 30px;
    border: 3px solid #10b981;
}

.at-corner-tl {
    top: 0;
    left: 0;
    border-right: none;
    border-bottom: none;
    border-top-left-radius: 1rem;
}

.at-corner-tr {
    top: 0;
    right: 0;
    border-left: none;
    border-bottom: none;
    border-top-right-radius: 1rem;
}

.at-corner-bl {
    bottom: 0;
    left: 0;
    border-right: none;
    border-top: none;
    border-bottom-left-radius: 1rem;
}

.at-corner-br {
    bottom: 0;
    right: 0;
    border-left: none;
    border-top: none;
    border-bottom-right-radius: 1rem;
}

.at-scanner-line {
    position: absolute;
    top: 50%;
    left: 10px;
    right: 10px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #10b981, transparent);
    animation: scanLine 2s ease-in-out infinite;
}

@keyframes scanLine {
    0%, 100% { transform: translateY(-50px); opacity: 0; }
    50% { transform: translateY(50px); opacity: 1; }
}

/* File Upload */
.at-divider {
    position: relative;
    text-align: center;
    margin: 1.5rem 0;
}

.at-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e5e7eb;
}

.at-divider span {
    background: white;
    padding: 0 1rem;
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 500;
}

.at-file-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    border: 2px dashed #d1d5db;
    border-radius: 0.5rem;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
}

.at-file-label:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    background: #f8fafc;
}

/* Scanner Status */
.at-scanner-status {
    display: flex;
    justify-content: center;
    padding: 1rem;
}

.at-status-message {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.3s;
}

.at-status-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.at-status-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.at-status-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.at-status-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

/* Scan History */
.at-scan-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
    background: #f9fafb;
}

.at-scan-entry:last-child {
    margin-bottom: 0;
}

.at-scan-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.at-scan-asset-id {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: #111827;
}

.at-scan-time {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    color: #6b7280;
}

/* Help Section */
.at-help-steps {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.at-help-step {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.at-step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    background: #3b82f6;
    color: white;
    border-radius: 50%;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.at-step-content h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
}

.at-step-content p {
    margin: 0;
    color: #6b7280;
    line-height: 1.5;
}

.at-help-tips {
    padding: 1.5rem;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 0.5rem;
}

.at-help-tips h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 1rem 0;
    color: #0369a1;
    font-weight: 600;
}

.at-help-tips ul {
    margin: 0;
    padding-left: 1.5rem;
    color: #0369a1;
}

.at-help-tips li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

/* Icons */
.at-icon-xs {
    width: 1rem;
    height: 1rem;
}

.at-icon-sm {
    width: 1.25rem;
    height: 1.25rem;
}

.at-icon-lg {
    width: 2rem;
    height: 2rem;
}

/* Lucide Icon Colors */
[data-lucide="eye"] {
    color: #000000 !important;
    stroke: #000000 !important;
}

[data-lucide="qr-code"] {
    color: #000000 !important;
    stroke: #000000 !important;
}

.at-spin {
    animation: spin 1s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .at-frontend-container {
        margin: 1rem auto;
        padding: 0 0.5rem;
    }
    
    .at-scanner-container {
        margin: 0.5rem auto;
        padding: 0 0.5rem;
    }
    
    .at-asset-header,
    .at-scanner-header {
        flex-direction: column;
        gap: 1.5rem;
        padding: 1.5rem;
    }
    
    .at-asset-info {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .at-asset-name {
        font-size: 1.5rem;
    }
    
    .at-current-location {
        text-align: center;
        min-width: auto;
    }
    
    .at-location-name {
        justify-content: center;
    }
    
    .at-last-scan {
        justify-content: center;
    }
    
    .at-scanner-header {
        text-align: center;
    }
    
    .at-scanner-title h1 {
        font-size: 1.5rem;
        justify-content: center;
    }
    
    .at-scanner-actions {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .at-card-content {
        padding: 1rem;
    }
    
    .at-coordinates-inputs {
        grid-template-columns: 1fr;
    }
    
    .at-info-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .at-form-actions {
        flex-direction: column;
    }
    
    .at-geolocation-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .at-activity-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .at-scanner-frame {
        width: 200px;
        height: 200px;
    }
    
    .at-input-group {
        flex-direction: column;
    }
    
    .at-scan-entry {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .at-help-step {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }
    
    .at-step-number {
        align-self: center;
    }
}

@media (max-width: 480px) {
    .at-scanner-frame {
        width: 180px;
        height: 180px;
    }
    
    .at-corner {
        width: 25px;
        height: 25px;
    }
    
    .at-asset-name {
        font-size: 1.25rem;
    }
    
    .at-scanner-title h1 {
        font-size: 1.25rem;
    }
    
    .at-btn {
        padding: 0.625rem 1rem;
        font-size: 0.75rem;
    }
}