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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8fafc;
    overflow-x: hidden;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ========================================
   Typography
   ======================================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.5em;
    color: #1a202c;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

p {
    margin-bottom: 1rem;
    color: #4a5568;
}

/* ========================================
   Layout Components
   ======================================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.section {
    padding: 80px 0;
}

/* ========================================
   Header
   ======================================== */
.header {
    background: linear-gradient(135deg, #667eea 0%, #007bff 100%);
    color: white;
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 20px rgba(0,0,0,0.1);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
    color: white;
    font-size: 1.8rem;
    font-weight: 700;
}

.navigation ul {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.navigation a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.3s ease;
}

.navigation a:hover {
    opacity: 0.8;
}

/* ========================================
   Hero Section
   ======================================== */
.hero {
    background: linear-gradient(135deg, #667eea 0%, #007bff 100%);
    color: white;
    padding: 80px 0;
    text-align: center;
}

.hero-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: white;
}

.hero-description {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    opacity: 0.9;
    color: white;
}

.hero-features {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.feature-badge {
    background: rgba(255,255,255,0.2);
    padding: 0.5rem 1rem;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

/* ========================================
   Main Application
   ======================================== */
.main-app {
    padding: 60px 0;
    background: white;
}

.app-wrapper {
    display: grid;
    gap: 2rem;
}

/* ========================================
   Upload Section
   ======================================== */
.upload-section {
    background: #f7fafc;
    border-radius: 12px;
    padding: 2rem;
    border: 2px dashed #e2e8f0;
    transition: all 0.3s ease;
}

.upload-area {
    text-align: center;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.upload-area:hover {
    background: #edf2f7;
    border-radius: 8px;
}

.upload-area.dragover {
    background: #e6fffa;
    border-color: #38b2ac;
}

.upload-content {
    padding: 2rem;
}

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

.upload-btn {
    background: linear-gradient(135deg, #667eea 0%, #007bff 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.4);
}

.file-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #e6fffa;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    border-left: 4px solid #38b2ac;
}

.file-details {
    display: flex;
    flex-direction: column;
}

.file-name {
    font-weight: 600;
    color: #2d3748;
}

.file-size {
    font-size: 0.9rem;
    color: #718096;
}

.remove-file {
    background: #fed7d7;
    color: #e53e3e;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background 0.3s ease;
}

.remove-file:hover {
    background: #feb2b2;
}

/* ========================================
   Controls Section
   ======================================== */
.controls-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    border: 1px solid #e2e8f0;
}

.controls-header {
    margin-bottom: 2rem;
}

.controls-header h3 {
    margin-bottom: 1rem;
}

.control-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.tab-btn {
    padding: 10px 20px;
    border: 2px solid #e2e8f0;
    background: #f7fafc;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.tab-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #007bff 100%);
    color: white;
    border-color: transparent;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.control-group {
    margin-bottom: 1.5rem;
}

.control-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.control-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #2d3748;
}

.control-group input[type="text"],
.control-group input[type="file"],
.control-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.control-group input[type="text"]:focus,
.control-group input[type="file"]:focus,
.control-group select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.control-group input[type="range"] {
    width: 100%;
    margin-bottom: 0.5rem;
}

.control-group input[type="color"] {
    width: 60px;
    height: 40px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
}

.page-selection-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #e2e8f0;
}

.page-selection-section h4 {
    margin-bottom: 1rem;
    color: #2d3748;
}

.radio-group {
    display: flex;
    gap: 2rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.radio-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
    color: #4a5568;
}

.radio-option input[type="radio"] {
    display: none;
}

.radio-custom {
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    border-radius: 50%;
    margin-right: 0.5rem;
    position: relative;
    transition: all 0.3s ease;
}

.radio-option input[type="radio"]:checked + .radio-custom {
    border-color: #007bff;
    background: #007bff;
}

.radio-option input[type="radio"]:checked + .radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.page-range-input {
    margin-top: 1rem;
}

.page-range-input label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #2d3748;
}

.page-range-input input {
    width: 100%;
    padding: 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.page-range-input input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.help-text {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #6b7280;
    font-style: italic;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

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

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #007bff 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.4);
}

.btn-secondary {
    background: #f7fafc;
    color: #4a5568;
    border: 1px solid #e2e8f0;
}

.btn-secondary:hover {
    background: #edf2f7;
    transform: translateY(-2px);
}

.btn-warning {
    background: #fed7d7;
    color: #e53e3e;
}

.btn-warning:hover {
    background: #feb2b2;
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.4);
}

/* ========================================
   Preview Section
   ======================================== */
.preview-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    border: 1px solid #e2e8f0;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.preview-container {
    text-align: center;
    margin-bottom: 1rem;
}

.preview-canvas-wrapper {
    position: relative;
    display: inline-block;
    background: #f7fafc;
    padding: 2rem;
    border-radius: 8px;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#pdfPreview {
    max-width: 100%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    border-radius: 4px;
    display: block;
}

.watermark-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.draggable-watermark {
    position: absolute;
    cursor: move;
    pointer-events: auto;
    user-select: none;
    z-index: 11;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    min-height: 20px;
    border: 2px dashed #007bff;
    background: rgba(0, 123, 255, 0.1);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.draggable-watermark:hover {
    border-color: #0056b3;
    background: rgba(0, 123, 255, 0.2);
    transform: scale(1.02);
}

.draggable-watermark.dragging {
    transform: rotate(2deg) scale(1.05);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    z-index: 20;
}

.watermark-preview-text {
    font-weight: bold;
    color: #007bff;
    font-size: 16px;
    text-align: center;
    white-space: nowrap;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
    pointer-events: none;
}

.watermark-preview-image {
    max-width: 100px;
    max-height: 100px;
    object-fit: contain;
    pointer-events: none;
    opacity: 0.8;
}

.drag-instructions {
    margin-top: 1rem;
    padding: 1rem;
    background: #e3f2fd;
    border: 1px solid #90caf9;
    border-radius: 8px;
    color: #1565c0;
    font-size: 0.9rem;
    text-align: center;
}

.drag-instructions p {
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.preview-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.page-controls button {
    width: 40px;
    height: 40px;
    border: 1px solid #d1d5db;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.page-controls button:hover {
    background: #f7fafc;
    border-color: #007bff;
}

.page-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========================================
   Content Sections
   ======================================== */
.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.step {
    text-align: center;
    padding: 2rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.step:hover {
    transform: translateY(-5px);
}

.step-number {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #007bff 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0 auto 1rem;
}

/* ========================================
   Features Section
   ======================================== */
.features-section {
    background: #f7fafc;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.feature-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
}

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

/* ========================================
   FAQ Section
   ======================================== */
.faq-section {
    background: white;
}

.faq-list {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.faq-question {
    padding: 1.5rem;
    background: #f7fafc;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s ease;
}

.faq-question:hover {
    background: #edf2f7;
}

.faq-question h3 {
    margin: 0;
    color: #2d3748;
}

.faq-toggle {
    font-size: 1.5rem;
    font-weight: bold;
    color: #007bff;
    transition: transform 0.3s ease;
}

.faq-item.active .faq-toggle {
    transform: rotate(45deg);
}

.faq-answer {
    padding: 0 1.5rem;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.faq-item.active .faq-answer {
    padding: 1.5rem;
    max-height: 200px;
}

/* ========================================
   Footer
   ======================================== */
.footer {
    background: #ccc0;
    color: black;
    padding: 3rem 0 1rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h4 {
    color: black;
    margin-bottom: 1rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: #000;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section a:hover {
    color: black;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #4a5568;
    color: #cbd5e0;
}

/* ========================================
   Loading States
   ======================================== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

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

/* ========================================
   Utilities
   ======================================== */
.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-description {
        font-size: 1rem;
    }
    
    .hero-features {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    
    .header .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .navigation ul {
        gap: 1rem;
    }
    
    .control-row {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .radio-group {
        flex-direction: column;
        gap: 1rem;
    }
    
    .draggable-watermark {
        min-width: 40px;
        min-height: 16px;
    }
    
    .watermark-preview-text {
        font-size: 14px;
    }
    
    .watermark-preview-image {
        max-width: 80px;
        max-height: 80px;
    }
    
    .preview-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .preview-info {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .steps-grid {
        grid-template-columns: 1fr;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .container {
        padding: 0 15px;
    }
    
    .section {
        padding: 40px 0;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 1.8rem;
    }
    
    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
    
    .upload-content {
        padding: 1rem;
    }
    
    .controls-section,
    .preview-section {
        padding: 1rem;
    }
    
    .step,
    .feature-card {
        padding: 1.5rem;
    }
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
    .header,
    .hero,
    .main-app,
    .footer {
        display: none;
    }
    
    body {
        background: white;
    }
}

/* ========================================
   Accessibility
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
button:focus,
input:focus,
select:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn-primary {
        background: #fff;
        border: 2px solid #000;
    }
    
    .btn-secondary {
        border: 2px solid #000;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #fff;
        color: #e2e8f0;
    }
    
    .upload-section,
    .controls-section,
    .preview-section,
    .step,
    .feature-card {
        background: #fff;
        border-color: #4a5568;
    }
    
    .faq-question {
        background: #fff;
        border-color: #4a5568;
    }
    
    input[type="text"],
    input[type="file"],
    select {
        background: #fff;
        border-color: #4a5568;
        color: #e2e8f0;
    }
}

/* Styled note box */
.note-box {
  margin: 1.5rem auto 0 auto;
  padding: 1rem 1.5rem;
  max-width: 700px;
  border: 2px solid #007bff;
  border-radius: 8px;
  background: #e9f5ff;
  font-size: 1rem;
  font-weight: 500;
  color: #0056b3;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.note-box p {
  margin: 0;
}

/* Related Tools Section */
.related-tools {
  margin-top: 3rem;
  padding: 1.5rem;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.related-tools h2 {
  margin-bottom: 1rem;
  font-size: 1.3rem;
  color: #007bff;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.tool-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1rem;
  background: #f9f9f9;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s, box-shadow 0.2s;
}

.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}

.tool-card .icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

footer p, footer a {
  color: #222 !important;  /* darker text */
}
