* {
    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: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.main-content {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 20px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.controls-panel {
    background: #f8f9fa;
    padding: 20px;
    border-right: 1px solid #e9ecef;
}

.control-group {
    margin-bottom: 20px;
}

.control-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
}

.control-group label input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.2);
}

.control-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    transition: border-color 0.3s ease;
}

.control-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.buttons-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 30px;
}

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

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd8;
}

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

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

.btn-success {
    background: #28a745;
    color: white;
}

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

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

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

.btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    opacity: 0.6;
}

.btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

.viewer-panel {
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.dwt-container {
    width: 100%;
    height: 600px;
    border: 2px dashed #e9ecef;
    border-radius: 8px;
    position: relative;
    background: #f8f9fa;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.placeholder {
    text-align: center;
    color: #6c757d;
}

.placeholder-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.placeholder-text {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.placeholder-subtext {
    font-size: 0.9rem;
    opacity: 0.7;
}

.image-info {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    font-weight: 600;
    color: #495057;
    font-size: 14px;
}

.status-panel {
    margin-top: 20px;
    background: white;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.status-message {
    font-size: 14px;
    color: #495057;
    text-align: center;
    padding: 5px;
}

.status-message.success {
    color: #28a745;
    font-weight: 600;
}

.status-message.error {
    color: #dc3545;
    font-weight: 600;
}

.status-message.warning {
    color: #ffc107;
    font-weight: 600;
}

.status-message.info {
    color: #17a2b8;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .controls-panel {
        border-right: none;
        border-bottom: 1px solid #e9ecef;
    }

    .buttons-group {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .btn {
        flex: 1;
        min-width: 120px;
    }

    header h1 {
        font-size: 2rem;
    }
}

/* Loading animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* Dynamic Web TWAIN specific styles */
.dynamsoft-dwt-container {
    width: 100% !important;
    height: 100% !important;
}

.dynamsoft-dwt-container>div {
    width: 100% !important;
    height: 100% !important;
}

/* Hide placeholder when DWT is loaded */
.dwt-container.dwt-loaded .placeholder {
    display: none;
}

/* Enhanced checkbox styles */
input[type="checkbox"] {
    accent-color: #667eea;
}

/* Version badge */
#dwt-version {
    background: #e9ecef;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

#dwt-version.loaded {
    background: #d4edda;
    color: #155724;
}