/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f8fafc;
    color: #334155;
    line-height: 1.6;
}

/* Login Page Styles */
.login-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-form {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.login-header {
    padding: 40px 40px 20px;
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.login-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.login-header p {
    opacity: 0.9;
    font-size: 16px;
}

.login-form-content {
    padding: 40px;
}

.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.error-icon {
    font-size: 18px;
}

.login-footer {
    padding: 20px;
    text-align: center;
    background: #f8fafc;
    color: #64748b;
    font-size: 14px;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #374151;
    font-size: 14px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.2s;
    background: white;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group small {
    color: #6b7280;
    font-size: 12px;
    margin-top: 4px;
    display: block;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 12px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 2px solid #e5e7eb;
    background: white;
    color: #374151;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
    line-height: 1;
}

.btn:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    transform: translateY(-1px);
}

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

.btn.btn-primary {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

.btn.btn-primary:hover {
    background: #2563eb;
    border-color: #2563eb;
}

.btn.btn-success {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

.btn.btn-success:hover {
    background: #059669;
    border-color: #059669;
}

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

.btn.btn-danger:hover {
    background: #dc2626;
    border-color: #dc2626;
}

.btn.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn.btn-lg {
    padding: 16px 24px;
    font-size: 16px;
}

.btn.btn-block {
    width: 100%;
    justify-content: center;
}

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

.btn-icon {
    font-size: 16px;
}

.btn-icon-only {
    padding: 8px;
    min-width: 36px;
    justify-content: center;
}

/* Header */
.header {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 16px 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-title {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info {
    color: #64748b;
    font-size: 14px;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Main Layout */
.main-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 24px;
    min-height: calc(100vh - 120px);
}

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Panel */
.panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.panel-header {
    padding: 16px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.panel-content {
    padding: 20px;
}

/* Campaign List */
.campaign-list {
    max-height: 400px;
    overflow-y: auto;
}

.campaign-item {
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.campaign-item:hover {
    background: #f8fafc;
}

.campaign-item.active {
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
}

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

.campaign-name {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 4px;
}

.campaign-meta {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 4px;
}

.campaign-date {
    font-size: 11px;
    color: #9ca3af;
}

.campaign-actions {
    position: absolute;
    top: 12px;
    right: 12px;
    display: none;
    gap: 4px;
}

.campaign-item:hover .campaign-actions {
    display: flex;
}

.btn-icon {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    transition: background 0.2s;
}

.btn-icon:hover {
    background: rgba(0, 0, 0, 0.1);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
}

.empty-state p {
    margin-bottom: 4px;
}

.empty-state small {
    font-size: 12px;
    color: #9ca3af;
}

/* Workspace */
.workspace {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.workspace-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.workspace-title h2 {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 4px;
}

.workspace-subtitle {
    font-size: 14px;
    color: #64748b;
}

.breakpoint-tabs {
    display: flex;
    gap: 4px;
    background: #e5e7eb;
    padding: 4px;
    border-radius: 8px;
}

.breakpoint-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: #64748b;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.breakpoint-tab.active {
    background: #3b82f6;
    color: white;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.breakpoint-tab:hover:not(.active) {
    background: #f1f5f9;
}

.tab-icon {
    font-size: 14px;
}

.workspace-controls {
    display: flex;
    gap: 8px;
}

.workspace-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Canvas */
.canvas-container {
    flex: 1;
    overflow: auto;
    background: #f1f5f9;
    position: relative;
}

.canvas {
    margin: 20px auto;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    transition: all 0.3s;
}

.canvas.desktop { 
    max-width: 600px; 
    width: 600px;
}

.canvas.tablet { 
    max-width: 480px; 
    width: 480px;
}

.canvas.mobile { 
    max-width: 320px; 
    width: 320px;
}

.canvas.creating-link {
    cursor: crosshair;
}

#imageContainer {
    position: relative;
    min-height: 300px;
}

.canvas-image {
    display: block;
    width: 100%;
    height: auto;
    position: relative;
}

/* Link Boxes */
.link-box {
    position: absolute;
    border: 2px solid #3b82f6;
    background: rgba(59, 130, 246, 0.1);
    cursor: move;
    min-width: 20px;
    min-height: 20px;
    z-index: 10;
}

.link-box.selected {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

.link-box:hover {
    border-color: #2563eb;
    background: rgba(37, 99, 235, 0.15);
}

.link-box .resize-handle {
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 8px;
    height: 8px;
    background: #3b82f6;
    cursor: se-resize;
    border-radius: 2px;
}

.link-box.selected .resize-handle {
    background: #ef4444;
}

/* Welcome Screen */
.welcome-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 600px;
    text-align: center;
}

.welcome-content {
    max-width: 600px;
    padding: 40px;
}

.welcome-content h1 {
    font-size: 48px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 16px;
}

.welcome-content > p {
    font-size: 20px;
    color: #64748b;
    margin-bottom: 40px;
}

.welcome-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 32px;
    margin-bottom: 40px;
}

.feature {
    text-align: center;
}

.feature-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 16px;
}

.feature h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 8px;
}

.feature p {
    font-size: 14px;
    color: #64748b;
}

.empty-canvas {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    text-align: center;
    color: #64748b;
}

.empty-canvas h3 {
    font-size: 24px;
    margin-bottom: 12px;
}

.empty-canvas p {
    margin-bottom: 24px;
    font-size: 16px;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #64748b;
    padding: 4px;
    line-height: 1;
}

.modal-close:hover {
    color: #374151;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: #f8fafc;
}

/* Link List */
.link-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.link-item {
    padding: 12px;
    background: #f8fafc;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.link-item:hover {
    background: #f1f5f9;
    border-color: #d1d5db;
}

.link-item.selected {
    border-color: #3b82f6;
    background: #eff6ff;
}

.link-item .link-url {
    font-weight: 500;
    color: #1e293b;
    margin-bottom: 4px;
    word-break: break-all;
}

.link-item .link-coords {
    color: #64748b;
    font-size: 12px;
}

/* Image List */
.image-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.image-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
    border: 2px dashed #e5e7eb;
    transition: all 0.2s;
    cursor: move;
}

.image-item:hover {
    border-color: #3b82f6;
    background: #f0f9ff;
}

.image-preview {
    width: 60px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    background: #f1f5f9;
    border: 1px solid #e5e7eb;
}

.image-info {
    flex: 1;
    font-size: 14px;
}

.image-info > div {
    font-weight: 500;
    color: #1e293b;
    margin-bottom: 2px;
}

.image-info small {
    color: #64748b;
    font-size: 12px;
}

/* Output Section */
.output-section {
    background: #1e293b;
    color: #f1f5f9;
    border-radius: 8px;
    padding: 16px;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 12px;
    max-height: 300px;
    overflow: auto;
    line-height: 1.4;
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #3b82f6;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 1001;
    animation: slideInRight 0.3s ease-out;
    max-width: 400px;
}

.notification.success {
    background: #10b981;
    color: white;
}

.notification.error {
    background: #ef4444;
    color: white;
}

.notification.warning {
    background: #f59e0b;
    color: white;
}

.notification.info {
    background: #3b82f6;
    color: white;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Tooltips */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 140px;
    background: #374151;
    color: white;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -70px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.3s;
}

.tooltip .tooltiptext::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #374151 transparent transparent transparent;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 20px; }

.hidden { display: none; }
.visible { display: block; }

.text-sm { font-size: 14px; }
.text-xs { font-size: 12px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 20px; }

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

.text-gray-500 { color: #6b7280; }
.text-gray-600 { color: #4b5563; }
.text-gray-700 { color: #374151; }
.text-gray-800 { color: #1f2937; }
.text-gray-900 { color: #111827; }

.text-blue-500 { color: #3b82f6; }
.text-blue-600 { color: #2563eb; }
.text-green-500 { color: #10b981; }
.text-green-600 { color: #059669; }
.text-red-500 { color: #ef4444; }
.text-red-600 { color: #dc2626; }