/* Reset และ Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 400px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
}

.header h1 {
    color: white;
    font-size: 24px;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.header p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
}

/* Main Content */
.main-content {
    background: white;
    border-radius: 20px;
    padding: 30px 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    text-align: center;
}

/* Camera Section */
.camera-section {
    margin-bottom: 0px;
}

.camera-button {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4CAF50, #45a049);
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.camera-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 20px rgba(76, 175, 80, 0.6);
}

.camera-button:active {
    transform: translateY(0);
}

.camera-icon {
    font-size: 40px;
    margin-bottom: 10px;
}

/* Hidden File Input */
#imageInput {
    display: none;
}

/* Preview Section */
.preview-section {
    margin: 20px 0;
    display: none;
}

.image-preview {
    max-width: 100%;
    max-height: 200px;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

/* Loading */
.loading {
    display: none;
    margin: 20px 0;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Results */
.result-section {
    display: none;
    margin: 20px 0;
}

.result-found {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 20px;
    border-radius: 10px;
    margin: 15px 0;
}

.result-not-found {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 20px;
    border-radius: 10px;
    margin: 15px 0;
}

.result-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.result-text {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
}

.license-info {
    background: rgba(255, 255, 255, 0.8);
    padding: 15px;
    border-radius: 8px;
    margin: 10px 0;
}

.license-info h3 {
    margin-bottom: 10px;
    color: #333;
}

.license-info p {
    margin: 5px 0;
    font-size: 16px;
}

/* Buttons */
.btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 10px 5px;
    text-decoration: none;
    display: inline-block;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d, #5a6268);
}

.btn-secondary:hover {
    box-shadow: 0 5px 15px rgba(108, 117, 125, 0.4);
}

/* Navigation */
.nav-links {
    text-align: center;
    margin-top: 20px;
}

.nav-links a {
    color: white;
    text-decoration: none;
    margin: 0 15px;
    font-size: 16px;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: #ffd700;
}

/* Files Page */
.files-container {
    background: white;
    border-radius: 20px;
    padding: 30px 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-top: 20px;
}

.file-list {
    list-style: none;
}

.file-item {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    padding: 15px;
    margin: 10px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.file-date {
    color: #6c757d;
    font-size: 14px;
}

.download-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.3s ease;
}

.download-btn:hover {
    background: #218838;
}

/* Error Messages */
.error-message {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 15px;
    border-radius: 10px;
    margin: 15px 0;
    text-align: center;
}

/* Responsive Design */
@media (max-width: 480px) {
    .container {
        padding: 15px;
    }

    .main-content {
        padding: 20px 15px;
    }

    .camera-button {
        width: 120px;
        height: 120px;
        font-size: 16px;
    }

    .camera-icon {
        font-size: 30px;
    }

    .header h1 {
        font-size: 20px;
    }

    .btn {
        padding: 10px 20px;
        font-size: 14px;
    }
}

/* Animations */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Success/Error Icons */
.icon-success {
    color: #28a745;
}

.icon-error {
    color: #dc3545;
}

/* Mobile Camera Optimization */
@media (max-width: 768px) {
    .camera-section {
        margin-bottom: 20px;
    }

    .image-preview {
        max-height: 150px;
    }

    .result-text {
        font-size: 16px;
    }

    .license-info p {
        font-size: 14px;
    }
}