/* MTG Proxy Generator - Premium Styling */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

.mtg-pg-app,
.mtg-pg-app-frontend {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #f3f4f6;
    background: #0f172a; /* Slate 900 */
    border-radius: 16px;
    padding: 24px;
    margin: 20px 0;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

/* Grid Layout for Configuration */
.mtg-pg-grid-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

@media (min-width: 768px) {
    .mtg-pg-grid-layout {
        grid-template-columns: 1fr 1fr;
    }
}

/* Glassmorphism Card Style */
.mtg-pg-card {
    background: rgba(30, 41, 59, 0.7); /* Slate 800 with opacity */
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 24px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.mtg-pg-card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.mtg-pg-card h2 {
    color: #f3f4f6;
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
}

/* Settings Form elements */
.mtg-pg-form-group {
    margin-bottom: 16px;
}

.mtg-pg-form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #94a3b8; /* Slate 400 */
    margin-bottom: 6px;
}

.mtg-pg-form-group select,
.mtg-pg-form-group input[type="text"],
.mtg-pg-form-group input[type="number"] {
    width: 100%;
    padding: 10px 14px;
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: #f3f4f6;
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.mtg-pg-form-group select:focus,
.mtg-pg-form-group input[type="text"]:focus,
.mtg-pg-form-group input[type="number"]:focus {
    border-color: #6366f1; /* Indigo 500 */
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Switch Styles (Toggle Button) */
.mtg-pg-switch-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.mtg-pg-switch-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #94a3b8;
}

.mtg-pg-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

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

.mtg-pg-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #334155;
    transition: .3s;
    border-radius: 24px;
}

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

input:checked + .mtg-pg-slider {
    background-color: #6366f1;
}

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

/* Drag & Drop Upload Zone */
.mtg-pg-dropzone {
    border: 2px dashed rgba(99, 102, 241, 0.4);
    border-radius: 8px;
    padding: 32px 16px;
    text-align: center;
    background: rgba(15, 23, 42, 0.4);
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.mtg-pg-dropzone:hover,
.mtg-pg-dropzone.dragover {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.05);
}

.mtg-pg-dropzone-icon {
    font-size: 2.5rem;
    color: #6366f1;
    margin-bottom: 12px;
    animation: float 3s ease-in-out infinite;
}

.mtg-pg-dropzone-text {
    font-size: 0.95rem;
    color: #cbd5e1;
    margin-bottom: 8px;
}

.mtg-pg-dropzone-hint {
    font-size: 0.75rem;
    color: #64748b;
}

/* Upload input */
.mtg-pg-file-input {
    display: none;
}

/* Buttons */
.mtg-pg-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.mtg-pg-btn {
    font-family: inherit;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s, transform 0.1s, box-shadow 0.2s;
}

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

.mtg-pg-btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

.mtg-pg-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.mtg-pg-btn-secondary {
    background: #334155;
    color: #cbd5e1;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.mtg-pg-btn-secondary:hover:not(:disabled) {
    background: #475569;
    color: #fff;
}

.mtg-pg-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

/* Progress Section */
.mtg-pg-progress-container {
    margin-top: 24px;
    display: none;
}

.mtg-pg-progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: #cbd5e1;
    margin-bottom: 8px;
}

.mtg-pg-progress-bar-bg {
    width: 100%;
    height: 8px;
    background: #1e293b;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.mtg-pg-progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #6366f1 0%, #10b981 100%);
    transition: width 0.2s ease;
}

/* Console Log Box */
.mtg-pg-console {
    background: #020617;
    border-radius: 6px;
    padding: 12px 16px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.8rem;
    color: #34d399; /* Emerald 400 */
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: 12px;
}

.mtg-pg-console-line {
    margin-bottom: 4px;
    line-height: 1.4;
}

.mtg-pg-console-line.error {
    color: #f87171;
}

.mtg-pg-console-line.info {
    color: #60a5fa;
}

/* Alert Notification */
.mtg-pg-alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.mtg-pg-alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.mtg-pg-alert-info {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    color: #818cf8;
}

/* Card Preview Section */
.mtg-pg-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 32px;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 12px;
}

.mtg-pg-preview-header h3 {
    margin: 0;
    color: #fff;
    font-size: 1.25rem;
}

.mtg-pg-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

/* CSS for simulated cards in preview */
.mtg-pg-preview-card {
    background: #ffffff;
    color: #000000;
    border-radius: 8px;
    padding: 12px;
    aspect-ratio: 2.5 / 3.5;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid #d1d5db;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-family: 'Inter', sans-serif;
    box-sizing: border-box;
    position: relative;
    user-select: none;
}

.mtg-pg-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid #000000;
    padding-bottom: 4px;
    font-weight: 700;
    font-size: 0.75rem;
}

.mtg-pg-card-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 70%;
}

.mtg-pg-card-mana {
    font-size: 0.7rem;
}

.mtg-pg-card-type {
    font-size: 0.65rem;
    font-style: italic;
    font-weight: 600;
    border-bottom: 1px solid #000000;
    padding: 2px 0;
    margin-top: 4px;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mtg-pg-card-text {
    font-size: 0.6rem;
    line-height: 1.35;
    flex-grow: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    white-space: pre-wrap;
    text-align: left;
    margin: 4px 0;
}

.mtg-pg-card-pt {
    align-self: flex-end;
    font-weight: 700;
    font-size: 0.75rem;
    border: 1px solid #000;
    padding: 1px 4px;
    border-radius: 3px;
    background: #f3f4f6;
    line-height: 1;
}

/* Animations */
@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-5px); }
    100% { transform: translateY(0px); }
}

/* Layout container for printable sheets - kept offscreen on screen to allow clientHeight measurements */
#mtg-proxy-gen-print-area {
    position: absolute;
    left: -9999mm;
    top: 0;
    width: 210mm;
    display: block;
}
