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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    height: 100vh;
    overflow: hidden;
}

/* App container */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-brand {
    display: flex;
    align-items: center;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    transition: opacity 0.3s ease;
}

.brand-link:hover {
    opacity: 0.8;
}

.brand-link i {
    font-size: 1.5rem;
    color: #ffd700;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    flex: 1;
    text-align: center;
}

.header-controls {
    display: flex;
    gap: 1rem;
}

.mode-switcher {
    display: flex;
    gap: 0.5rem;
    margin: 0 2rem;
}

.btn-mode {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-mode:hover {
    background: rgba(255, 255, 255, 0.3);
}

.btn-mode.active {
    background: rgba(255, 255, 255, 0.9);
    color: #667eea;
    border-color: rgba(255, 255, 255, 0.9);
}

/* Mode switcher in sidebar */
.sidebar .mode-switcher {
    display: flex;
    gap: 0.25rem;
    margin: 0 0 1rem 0;
    padding: 0 1rem;
}

.sidebar .mode-switcher .btn-mode,
.sidebar .mode-switcher #designModeBtn,
.sidebar .mode-switcher #generateModeBtn,
.sidebar .mode-switcher #designModeBtn2,
.sidebar .mode-switcher #generateModeBtn2 {
    flex: 1;
    background: #f8f9fa !important;
    color: #495057 !important;
    border: 1px solid #dee2e6 !important;
    padding: 0.5rem 0.75rem !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    font-size: 0.875rem !important;
    text-align: center !important;
    font-weight: 500 !important;
    display: inline-block !important;
    text-decoration: none !important;
}

.sidebar .mode-switcher .btn-mode:hover,
.sidebar .mode-switcher #designModeBtn:hover,
.sidebar .mode-switcher #generateModeBtn:hover,
.sidebar .mode-switcher #designModeBtn2:hover,
.sidebar .mode-switcher #generateModeBtn2:hover {
    background: #e9ecef !important;
    border-color: #adb5bd !important;
}

.sidebar .mode-switcher .btn-mode.active,
.sidebar .mode-switcher #designModeBtn.active,
.sidebar .mode-switcher #generateModeBtn.active,
.sidebar .mode-switcher #designModeBtn2.active,
.sidebar .mode-switcher #generateModeBtn2.active {
    background: #667eea !important;
    color: white !important;
    border-color: #667eea !important;
}

/* Generate controls in sidebar */
.sidebar .generate-controls {
    margin: 0 0 1.5rem 0;
    padding: 0 1rem;
}

.sidebar .generate-controls .btn {
    width: 100%;
    margin-bottom: 0.5rem;
}

.sidebar .generate-controls .btn:last-child {
    margin-bottom: 0;
}

.control-group {
    display: flex;
    gap: 0.5rem;
}

/* Main content */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 300px;
    background: white;
    border-right: 1px solid #e0e0e0;
    padding: 1.5rem;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0,0,0,0.05);
}

.sidebar h3 {
    margin-bottom: 1rem;
    color: #555;
    font-size: 1rem;
    border-bottom: 2px solid #667eea;
    padding-bottom: 0.5rem;
}

/* Design Controls */
.design-controls {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e0e0e0;
}

.design-controls .btn {
    width: 100%;
    margin-bottom: 0.5rem;
}

.design-controls .btn:last-child {
    margin-bottom: 0;
}

/* Toolbar */
.toolbar {
    margin-bottom: 2rem;
}

/* Draggable text block */
.draggable-text-block {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border: 2px dashed #667eea;
    border-radius: 8px;
    cursor: grab;
    margin-bottom: 1rem;
    transition: all 0.2s ease;
    user-select: none;
}

.draggable-text-block:hover {
    background: #e3f2fd;
    border-color: #5a6fd8;
    transform: translateY(-1px);
}

.draggable-text-block:active {
    cursor: grabbing;
    transform: scale(0.98);
}

.drag-icon {
    font-size: 1.2rem;
}

.drag-label {
    font-weight: 500;
    color: #667eea;
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

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

.btn-primary:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
}

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

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.btn-upgrade {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%) !important;
    color: white !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3) !important;
    padding: 0.5rem 1.5rem !important;
    margin: 0 0.75rem !important;
}

.btn-upgrade:hover {
    background: linear-gradient(135deg, #ff5252 0%, #d63031 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
}

/* Fix layout issues for upgrade button */
#upgradePlanBtn {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    margin-left: 0.75rem !important;
    margin-right: 0.75rem !important;
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
    position: relative !important;
    z-index: 10 !important;
    min-width: 120px !important;
}

.btn-tool {
    background: #e9ecef;
    color: #495057;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

.btn-tool:hover {
    background: #dee2e6;
}

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

.btn-small {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    margin-right: 0.3rem;
}

/* Text properties */
.text-properties {
    margin-bottom: 2rem;
}

.property-group {
    margin-bottom: 1rem;
}

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

.property-group input,
.property-group select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.property-group .btn {
    width: 100%;
    margin-bottom: 0.5rem;
}

.alignment-buttons {
    display: flex;
    gap: 0.3rem;
}

.template-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.5rem;
}

.template-tag {
    background: #e3f2fd;
    color: #1976d2;
    border: 1px solid #bbdefb;
    font-size: 0.75rem;
    padding: 0.2rem 0.4rem;
}

.template-tag:hover {
    background: #bbdefb;
    border-color: #90caf9;
}

/* Draggable template tags */
.draggable-template-tag {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #e3f2fd;
    border: 2px dashed #1976d2;
    border-radius: 6px;
    cursor: grab;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
    user-select: none;
    font-size: 0.8rem;
}

.draggable-template-tag:hover {
    background: #bbdefb;
    border-color: #1565c0;
    transform: translateY(-1px);
}

.draggable-template-tag:active {
    cursor: grabbing;
    transform: scale(0.98);
}

.draggable-template-tag .drag-icon {
    font-size: 1rem;
}

.draggable-template-tag .drag-label {
    font-weight: 500;
    color: #1976d2;
}


/* Background controls */
.background-controls {
    margin-top: 2rem;
}

.bg-preview {
    margin-top: 1rem;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    max-width: 100%;
}

.bg-preview img {
    width: 100%;
    height: auto;
    max-height: 100px;
    object-fit: cover;
    display: block;
}


/* Slide editor */
.slide-editor {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    background: #e9ecef;
    min-height: 0;
    overflow: hidden;
}

#designModeContent {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.slide-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f1f3f4;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
    min-height: 0;
    margin: 0 0.5rem;
    max-height: 100%;
}

.slide {
    width: 800px;
    height: 566px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    position: relative;
    cursor: crosshair;
}

.slide.add-text-mode {
    cursor: crosshair;
}

.slide.select-mode {
    cursor: default;
}

.slide.drag-over {
    background: rgba(102, 126, 234, 0.1);
    border-color: #667eea;
}

/* Text elements */
.text-element {
    position: absolute;
    min-width: 150px;
    min-height: 30px;
    padding: 0.5rem;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: move;
    user-select: none;
    background: transparent;
    outline: none;
    resize: none;
    overflow: hidden;
    font-family: inherit;
    line-height: 1.4;
}

.text-element:hover {
    border-color: #667eea;
}

.text-element.selected {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    position: relative;
}

.text-element.selected::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 2px solid #667eea;
    border-radius: 6px;
    pointer-events: none;
}

.text-element.editing {
    border-color: #28a745;
    background: rgba(40, 167, 69, 0.1);
    cursor: text;
    user-select: text;
}

.text-element:focus {
    outline: none;
    border-color: #28a745;
    background: rgba(40, 167, 69, 0.1);
}

.template-tag-element {
    background: rgba(25, 118, 210, 0.1) !important;
    border: 1px dashed #1976d2 !important;
    border-radius: 4px !important;
    font-weight: 500 !important;
    color: #1976d2;
}

.template-tag-element:hover {
    background: rgba(25, 118, 210, 0.2) !important;
    border-color: #1565c0 !important;
}

.template-tag-element.selected {
    background: rgba(25, 118, 210, 0.2) !important;
    border-color: #1976d2 !important;
}


/* Responsive design */
@media (max-width: 1200px) {
    .sidebar {
        width: 250px;
    }
    
    .slide {
        width: 600px;
        height: 450px;
    }
}

@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        max-height: 40vh;
    }
    
    .slide {
        width: 100%;
        max-width: 500px;
        height: 400px;
    }
}

/* Animation for adding elements */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.text-element.new {
    animation: fadeIn 0.3s ease;
}

/* Drag preview */
.drag-preview {
    opacity: 0.7;
    transform: rotate(5deg);
    z-index: 1000;
}

/* Resize handles */
.resize-handle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #667eea;
    border: 1px solid white;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
}

.resize-handle.nw {
    top: -4px;
    left: -4px;
    cursor: nw-resize;
}

.resize-handle.ne {
    top: -4px;
    right: -4px;
    cursor: ne-resize;
}

.resize-handle.sw {
    bottom: -4px;
    left: -4px;
    cursor: sw-resize;
}

.resize-handle.se {
    bottom: -4px;
    right: -4px;
    cursor: se-resize;
}

.resize-handle.n {
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    cursor: n-resize;
}

.resize-handle.s {
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    cursor: s-resize;
}

.resize-handle.w {
    top: 50%;
    left: -4px;
    transform: translateY(-50%);
    cursor: w-resize;
}

.resize-handle.e {
    top: 50%;
    right: -4px;
    transform: translateY(-50%);
    cursor: e-resize;
}

/* Selection box */
.selection-box {
    position: absolute;
    border: 2px dashed #667eea;
    background: rgba(102, 126, 234, 0.1);
    pointer-events: none;
    z-index: 100;
}

/* Generate Mode Styles */
.generate-header {
    margin-bottom: 2rem;
    text-align: center;
}

.generate-header h2 {
    color: #555;
    margin-bottom: 1rem;
}

.progress-section {
    margin-top: 1rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.9rem;
    color: #666;
    text-align: center;
}

.generated-certificates {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    max-height: 60vh;
    overflow-y: auto;
}

.no-certificates {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: #666;
}

.no-certificates .icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.no-certificates h3 {
    margin-bottom: 0.5rem;
    color: #555;
}

.certificate-preview {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1rem;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

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

.certificate-preview img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.certificate-info {
    font-size: 0.8rem;
    color: #666;
}

.certificate-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.3rem;
}

.file-info {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 0.5rem;
    margin-top: 0.5rem;
}

.file-name {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.3rem;
}

.file-stats {
    font-size: 0.8rem;
    color: #6c757d;
}

.preview-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 0.5rem;
}

.preview-item {
    padding: 0.5rem;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.8rem;
}

.preview-item:last-child {
    border-bottom: none;
}

.preview-item .name {
    font-weight: 600;
    color: #333;
}

.preview-item .details {
    color: #666;
    margin-top: 0.2rem;
}

/* Certificate Preview Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 90vw;
    max-height: 90vh;
    width: 800px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.modal-header h3 {
    margin: 0;
    color: #333;
}

.modal-header button {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.modal-header button:hover {
    background: #e9ecef;
    color: #333;
}

.modal-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.preview-image-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    background: #f8f9fa;
    overflow: auto;
}

.preview-image-container img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;
}

.preview-info {
    padding: 1.5rem;
    border-top: 1px solid #e0e0e0;
    background: white;
}

.preview-details {
    margin-bottom: 1rem;
}

.preview-details h4 {
    margin: 0 0 0.5rem 0;
    color: #333;
    font-size: 1.1rem;
}

.preview-details p {
    margin: 0.25rem 0;
    color: #666;
    font-size: 0.9rem;
}

.preview-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
}

.preview-actions button {
    min-width: 100px;
}

/* Enhanced certificate preview cards */
.certificate-preview {
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.certificate-preview img {
    transition: transform 0.2s ease;
}

.certificate-preview:hover img {
    transform: scale(1.02);
}

/* Manual Data Editor */
.data-source-toggle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.data-source-toggle button {
    flex: 1;
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    background: white;
    color: #666;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.data-source-toggle button.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.data-source-toggle button:hover:not(.active) {
    background: #f8f9fa;
    border-color: #667eea;
}

.manual-data-editor-window {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    overflow: hidden;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.editor-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.2rem;
    font-weight: 600;
}

.editor-controls {
    display: flex;
    gap: 0.5rem;
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

.data-table-container {
    flex: 1;
    overflow-y: auto;
    max-height: calc(70vh - 80px);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th {
    background: #f8f9fa;
    padding: 0.75rem 0.5rem;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table td {
    padding: 0.5rem;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: top;
}

.data-table input {
    width: 100%;
    padding: 0.4rem 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85rem;
    transition: border-color 0.2s ease;
}

.data-table input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.data-table .actions-cell {
    text-align: center;
    width: 80px;
}

.data-table .btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    margin: 0 0.1rem;
    border-radius: 3px;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.data-table .btn-icon:hover {
    background: #f0f0f0;
}

.data-table .btn-delete {
    color: #dc3545;
}

.data-table .btn-delete:hover {
    background: #f8d7da;
    color: #721c24;
}

.data-table .btn-duplicate {
    color: #28a745;
}

.data-table .btn-duplicate:hover {
    background: #d4edda;
    color: #155724;
}

.data-table tbody tr:hover {
    background: #f8f9fa;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.empty-table-message {
    text-align: center;
    padding: 2rem;
    color: #666;
    font-style: italic;
}

.empty-table-message .icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: block;
}

/* Design Picker Modal */
.design-picker-modal {
    max-width: 900px;
    width: 90%;
}

.design-picker-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    padding: 20px 0 15px 20px;
    border-bottom: 1px solid #eee;
}

.design-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    max-height: 500px;
    overflow-y: auto;
    padding: 10px 0;
}

.design-card {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.design-card:hover {
    border-color: #007bff;
    box-shadow: 0 4px 8px rgba(0,123,255,0.15);
}

.design-card.selected {
    border-color: #007bff;
    background: #f8f9ff;
}

.design-preview {
    width: 100%;
    height: 120px;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.design-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.design-preview-placeholder {
    color: #6c757d;
    font-size: 14px;
    text-align: center;
}

.design-info {
    text-align: center;
}

.design-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    font-size: 14px;
}

.design-date {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 10px;
}

.design-actions {
    display: flex;
    justify-content: center;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.2s;
}

.design-card:hover .design-actions {
    opacity: 1;
}

.design-action-btn {
    background: none;
    border: none;
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    color: #6c757d;
    transition: all 0.2s;
}

.design-action-btn:hover {
    background: #f8f9fa;
    color: #333;
}

.design-action-btn.rename {
    color: #007bff;
}

.design-action-btn.clone {
    color: #28a745;
}

.design-action-btn.export {
    color: #6f42c1;
}

.design-action-btn.delete {
    color: #dc3545;
}

.design-action-btn.delete:hover {
    background: #f8d7da;
    color: #721c24;
}

.no-designs {
    text-align: center;
    padding: 40px 20px;
}

.empty-state {
    color: #6c757d;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-state h4 {
    margin: 0 0 10px 0;
    color: #495057;
}

.empty-state p {
    margin: 0 0 20px 0;
}

/* Design Name Input */
.design-name-input {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    background: white;
}

.design-name-input:focus {
    outline: none;
    border-color: #007bff;
}

.design-name-display {
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background 0.2s;
}

.design-name-display:hover {
    background: #f8f9fa;
}

/* Design Preview Container */
.design-preview-container {
    margin-bottom: 1rem;
}

.design-preview-image {
    width: 100%;
    height: 120px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.design-preview-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.no-preview-message {
    color: #6c757d;
    font-size: 14px;
    text-align: center;
    font-style: italic;
}

/* Selected Design Info */
.selected-design-info {
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e9ecef;
    text-align: center;
}

.selected-design-info .design-name-display {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

/* Authentication Styles */
.auth-section {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: nowrap;
}

.auth-section span {
    color: white;
    font-weight: 500;
}

.user-details {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

#userInfo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: nowrap;
}

.subscription-info {
    font-size: 0.8rem;
    opacity: 0.9;
}

.subscription-plan {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.subscription-plan.free {
    background: rgba(108, 117, 125, 0.3);
    color: #e9ecef;
}

.subscription-plan.starter {
    background: rgba(40, 167, 69, 0.3);
    color: #d4edda;
}

.subscription-plan.pro {
    background: rgba(0, 123, 255, 0.3);
    color: #cce7ff;
}

.subscription-plan.ultimate {
    background: rgba(220, 53, 69, 0.3);
    color: #f8d7da;
}

.auth-modal {
    max-width: 450px;
    width: 90%;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem 2rem 1.5rem;
    text-align: center;
    position: relative;
}

.modal-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.btn-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.5rem;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.auth-container {
    padding: 2rem;
}

.social-login {
    margin-bottom: 1.5rem;
}

.btn-social {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    background: white;
    color: #374151;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    position: relative;
    overflow: hidden;
}

.btn-social:hover {
    border-color: #d1d5db;
    background: #f9fafb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

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

.btn-google {
    border-color: #dadce0;
}

.btn-google:hover {
    border-color: #c1c4c8;
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.15);
}

.social-icon {
    flex-shrink: 0;
}

.divider {
    position: relative;
    text-align: center;
    margin: 1.5rem 0;
    color: #6b7280;
    font-size: 0.875rem;
}

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

.divider span {
    background: white;
    padding: 0 1rem;
    position: relative;
}

.auth-form {
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
    position: relative;
}

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

.form-group input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    background: #fafafa;
}

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

.form-group input:invalid:not(:placeholder-shown) {
    border-color: #ef4444;
    background: #fef2f2;
}

.form-group input:valid:not(:placeholder-shown) {
    border-color: #10b981;
    background: #f0fdf4;
}

.input-error {
    color: #ef4444;
    font-size: 0.75rem;
    margin-top: 0.25rem;
    min-height: 1rem;
}

.password-strength {
    margin-top: 0.5rem;
}

.strength-bar {
    width: 100%;
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.25rem;
}

.strength-fill {
    height: 100%;
    width: 0%;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.strength-fill.weak {
    width: 33%;
    background: #ef4444;
}

.strength-fill.medium {
    width: 66%;
    background: #f59e0b;
}

.strength-fill.strong {
    width: 100%;
    background: #10b981;
}

.strength-text {
    font-size: 0.75rem;
    color: #6b7280;
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.checkbox-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.875rem;
    color: #6b7280;
    position: relative;
    padding-left: 1.75rem;
}

.checkbox-container input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 1.25rem;
    width: 1.25rem;
    background: white;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.checkbox-container:hover input ~ .checkmark {
    border-color: #667eea;
}

.checkbox-container input:checked ~ .checkmark {
    background: #667eea;
    border-color: #667eea;
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 0.25rem;
    top: 0.125rem;
    width: 0.25rem;
    height: 0.5rem;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.forgot-password {
    color: #667eea;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.forgot-password:hover {
    color: #5a6fd8;
    text-decoration: underline;
}

.terms-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.terms-link:hover {
    text-decoration: underline;
}

.btn-full {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

.btn-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.auth-switch {
    text-align: center;
    color: #6b7280;
    font-size: 0.875rem;
}

.auth-switch a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.auth-switch a:hover {
    color: #5a6fd8;
    text-decoration: underline;
}

.error-message {
    background: #fef2f2;
    color: #dc2626;
    padding: 0.875rem 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    border: 1px solid #fecaca;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.error-message::before {
    content: "⚠️";
    font-size: 1rem;
}

.success-message {
    background: #f0fdf4;
    color: #16a34a;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    border: 1px solid #bbf7d0;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

.success-message .btn {
    flex-shrink: 0;
    white-space: nowrap;
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
    min-width: auto;
    max-width: calc(50% - 0.25rem);
    text-overflow: ellipsis;
    overflow: hidden;
}

.success-message .btn-secondary {
    color: #1f2937 !important;
    background-color: #f9fafb !important;
    border-color: #d1d5db !important;
    font-weight: 600 !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.success-message .btn-secondary * {
    color: #374151 !important;
}

.success-message .btn-secondary:hover {
    color: #000000 !important;
    background-color: #e5e7eb !important;
    border-color: #9ca3af !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.success-message::before {
    content: "✅";
    font-size: 1rem;
    margin-right: 0.25rem;
}

/* Loading state for buttons */
.btn.loading .btn-text {
    opacity: 0;
}

.btn.loading .btn-spinner {
    display: block;
}

/* Force upgrade button padding - highest specificity */
button#upgradePlanBtn.btn-upgrade {
    padding: 0.5rem 1.5rem !important;
    margin: 0 0.75rem !important;
    min-width: 120px !important;
    box-sizing: border-box !important;
}

/* Responsive design for auth modals */
@media (max-width: 480px) {
    .auth-modal {
        width: 95%;
        margin: 1rem;
    }
    
    .auth-container {
        padding: 1.5rem;
    }
    
    .modal-header {
        padding: 1.5rem 1.5rem 1rem;
    }
    
    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
}