:root {
    --primary-color: #0066cc;
    --secondary-color: #666;
    --error-color: #d32f2f;
    --success-color: #388e3c;
    --border-color: #ddd;
    --bg-light: #f5f5f5;
    --text-dark: #333;
    --text-light: #666;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-light);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: white;
    border-bottom: 3px solid var(--primary-color);
    padding: 20px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header .container {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    width: 100px;
    height: auto;
}

.header h1 {
    font-size: 24px;
    color: var(--text-dark);
}

/* Main Content */
.main-content {
    padding: 40px 0;
    min-height: calc(100vh - 200px);
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* Error State */
.error-state {
    text-align: center;
    padding: 60px 20px;
}

.error-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.error-state h2 {
    color: var(--error-color);
    margin-bottom: 10px;
}

.error-state p {
    color: var(--text-light);
    margin-bottom: 20px;
}

/* Viewer State */
.viewer-layout {
    display: flex;
    flex-direction: row;
    gap: 40px;
    align-items: flex-start;
    justify-content: center;
    max-width: 1400px;
    margin: 0 auto;
}

.viewer-left {
    width: 350px;
    flex-shrink: 0;
}

.viewer-right {
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
}

.viewer-info {
    margin-bottom: 30px;
}

.viewer-info h2 {
    margin-bottom: 10px;
}

.viewer-info p {
    color: var(--text-light);
    line-height: 1.6;
}

/* Canvas Container */
.canvas-container {
    position: relative;
    display: inline-block;
    background: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-radius: 4px;
    overflow: hidden;
}

#pdf-canvas,
#selection-canvas {
    display: block;
}

#selection-canvas {
    position: absolute;
    top: 0;
    left: 0;
    cursor: crosshair;
}

/* Controls */
.controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.controls .btn {
    width: 100%;
}

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

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

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #0052a3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.btn-secondary {
    background-color: white;
    color: var(--text-dark);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background-color: #2e7d32;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Aspect Ratio Info */
.aspect-ratio-info {
    background: #f0f8ff;
    border: 2px solid #0066cc;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 12px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.aspect-ratio-info .aspect-ratio {
    font-size: 18px;
    font-weight: bold;
    color: var(--text-dark);
}

.aspect-ratio-info .status {
    font-size: 14px;
    font-weight: 500;
}

.aspect-ratio-info .status.optimal {
    color: var(--success-color);
}

.aspect-ratio-info .status.warning {
    color: #f57c00;
}

.optimal-tip {
    background: #fff9e6;
    border-left: 4px solid #ffc107;
    padding: 10px 12px;
    margin-top: 12px;
    font-size: 14px;
    border-radius: 4px;
}

/* Share Result State */
.share-result-layout {
    display: flex;
    flex-direction: row;
    gap: 40px;
    align-items: flex-start;
    justify-content: center;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

.share-result-left {
    width: 450px;
    flex-shrink: 0;
}

.share-result-left h2 {
    color: var(--success-color);
    margin-bottom: 30px;
}

.share-result-right {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow: hidden;
}

.share-preview {
    width: 100%;
    max-width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.share-preview img {
    width: 100%;
    height: auto;
    max-width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.share-links {
    margin-bottom: 30px;
}

.share-url-container {
    margin-bottom: 30px;
}

.share-url-container label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--text-dark);
}

.url-copy-group {
    display: flex;
    gap: 10px;
}

.url-copy-group input {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    font-family: monospace;
}

.social-buttons h3 {
    margin-bottom: 15px;
    color: var(--text-dark);
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-social {
    width: 100%;
    color: white;
}

.btn-x {
    background-color: #000000;
}

.btn-x:hover {
    background-color: #333333;
}

.btn-facebook {
    background-color: #4267B2;
}

.btn-facebook:hover {
    background-color: #365899;
}

.btn-linkedin {
    background-color: #0077B5;
}

.btn-linkedin:hover {
    background-color: #006399;
}

.btn-email {
    background-color: #666;
}

.btn-email:hover {
    background-color: #555;
}

#new-selection-btn {
    width: 100%;
    margin-top: 20px;
}

/* Footer */
.footer {
    background: white;
    border-top: 1px solid var(--border-color);
    padding: 20px 0;
    text-align: center;
    color: var(--text-light);
}

/* Responsive */
@media (max-width: 968px) {
    .viewer-layout {
        flex-direction: column;
    }

    .viewer-left {
        width: 100%;
    }

    .viewer-right {
        width: 100%;
    }

    .share-result-layout {
        flex-direction: column;
    }

    .share-result-left {
        width: 100%;
    }

    .share-result-right {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 18px;
    }

    .logo {
        height: 40px;
    }

    .share-result {
        padding: 20px;
    }

    .button-group {
        flex-direction: column;
    }

    .btn-social {
        width: 100%;
    }

    .url-copy-group {
        flex-direction: column;
    }
}

/* Subscribe Button Styling */
.subscribe-btn {
    display: inline-block;
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--primary-color), #0052a3);
    color: white !important;
    text-decoration: none !important;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: none;
    cursor: pointer;
    width: 100%;
}

.subscribe-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    background: linear-gradient(135deg, #0052a3, var(--primary-color));
}

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

/* Publication-specific subscribe button colors */
body[data-publication="pharmacydaily"] .subscribe-btn {
    background: linear-gradient(135deg, #00a651, #008040);
}

body[data-publication="pharmacydaily"] .subscribe-btn:hover {
    background: linear-gradient(135deg, #008040, #00a651);
}

body[data-publication="cruiseweekly"] .subscribe-btn {
    background: linear-gradient(135deg, #003d7a, #002855);
}

body[data-publication="cruiseweekly"] .subscribe-btn:hover {
    background: linear-gradient(135deg, #002855, #003d7a);
}
