/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Hidden class */
.hidden {
    display: none !important;
}

/* Login container */
.login-container {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.login-container header {
    background: linear-gradient(135deg, #0066FF 0%, #001A4D 100%);
    color: white;
    padding: 2rem 1.5rem;
    text-align: center;
}

.login-container header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.login-container header p {
    font-size: 0.95rem;
    opacity: 0.9;
}

.login-form {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-form h2 {
    text-align: center;
    color: #0052CC;
    margin-bottom: 0.5rem;
}

.login-form input {
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.login-form input:focus {
    outline: none;
    border-color: #0052CC;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #0066FF 0%, #001A4D 100%);
    min-height: 100vh;
    padding: 1rem;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

/* Header */
header {
    background: linear-gradient(135deg, #0066FF 0%, #001A4D 100%);
    color: white;
    padding: 2rem 1.5rem;
    text-align: center;
}

header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

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

/* Main content */
main {
    padding: 2rem 1.5rem;
}

/* Input buttons */
.input-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    border: 2px solid #0052CC;
    border-radius: 8px;
    background: white;
    color: #0052CC;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 60px;
}

.btn:hover {
    background: #0052CC;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 82, 204, 0.3);
}

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

.btn svg {
    flex-shrink: 0;
}

/* Preview container */
.preview-container {
    margin-bottom: 2rem;
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 1rem;
    background: #f9f9f9;
}

.preview-container.hidden {
    display: none;
}

.preview-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

#preview-canvas {
    max-width: 100%;
    max-height: 500px;
    display: block;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Rotate button */
.rotate-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 82, 204, 0.9);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.rotate-btn:hover {
    background: rgba(0, 82, 204, 1);
    transform: rotate(90deg);
}

.rotate-btn:active {
    transform: rotate(90deg) scale(0.95);
}

/* Form group */
.form-group {
    margin-bottom: 2rem;
}

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

.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    transition: border-color 0.3s ease;
}

.form-group textarea:focus {
    outline: none;
    border-color: #0052CC;
}

.char-counter {
    margin-top: 0.5rem;
    text-align: right;
    font-size: 0.85rem;
    color: #666;
}

#char-count {
    font-weight: 600;
    color: #0052CC;
}

/* Upload button */
.btn-upload {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #0066FF 0%, #001A4D 100%);
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 1rem;
}

.btn-upload:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 82, 204, 0.4);
}

.btn-upload:active:not(:disabled) {
    transform: translateY(0);
}

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

/* Status message */
.status {
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
    display: none;
}

.status.success {
    display: block;
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status.error {
    display: block;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.status.info {
    display: block;
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Footer */
footer {
    background: #f8f9fa;
    padding: 1.5rem;
    text-align: center;
    border-top: 1px solid #e9ecef;
}

footer p {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.25rem;
}

footer p.version {
    font-size: 0.75rem;
    color: #999;
    font-style: italic;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-overlay.hidden {
    display: none;
}

.loading-overlay p {
    color: white;
    font-size: 1.2rem;
    margin-top: 1rem;
}

/* Spinner animation */
.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive design for larger screens */
@media (min-width: 768px) {
    body {
        padding: 2rem;
    }

    header h1 {
        font-size: 2rem;
    }

    .input-buttons {
        gap: 1.5rem;
    }

    .btn {
        font-size: 1.1rem;
        padding: 1.25rem;
    }

    main {
        padding: 2.5rem 2rem;
    }
}

/* Touch device optimization */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 64px;
    }

    .rotate-btn {
        width: 56px;
        height: 56px;
    }
}
