/* Universal PDF Tools - Shared Theme Styles */

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');

/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Root Variables for Theme Colors */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --text-dark: #333;
    --text-medium: #666;
    --text-light: #999;
    --white: #ffffff;
    --light-bg: #f8f9ff;
    --border-color: #e0e0e0;
    --shadow-light: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 8px 24px rgba(0, 0, 0, 0.15);
    --shadow-heavy: 0 20px 60px rgba(0, 0, 0, 0.3);
    --border-radius: 15px;
    --border-radius-small: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Body Styles */
body {
    font-family: 'Roboto', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--primary-gradient);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* Container Styles */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Navigation Styles */
nav {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: var(--shadow-light);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    cursor: pointer;
    text-decoration: none;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 30px;
    align-items: center;
}

.nav-item {
    position: relative;
}

.nav-link {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
    padding: 10px 0;
    display: block;
}

.nav-link:hover {
    color: var(--primary-color);
}

/* Dropdown Styles */
.dropdown {
    position: relative;
}

.dropdown-toggle::after {
    content: ' ▾';
    font-size: 0.8rem;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--white);
    min-width: 250px;
    box-shadow: var(--shadow-medium);
    border-radius: var(--border-radius-small);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition);
    margin-top: 10px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1001;
    white-space: nowrap;
}

.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    padding: 12px 20px;
    color: var(--text-dark);
    text-decoration: none;
    display: block;
    transition: var(--transition);
    border-left: 3px solid transparent;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-item:hover {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.1) 0%, transparent 100%);
    border-left-color: var(--primary-color);
    padding-left: 25px;
}

/* Hamburger Menu */
.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 5px;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background: var(--primary-color);
    border-radius: 3px;
    transition: var(--transition);
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Header Styles */
header {
    text-align: center;
    margin-bottom: 50px;
    margin-top: 30px;
    animation: fadeInDown 0.8s ease-out;
}

h1 {
    color: var(--white);
    font-size: 3rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    font-weight: 700;
}

.subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.2rem;
    font-weight: 300;
}

/* Card Grid Styles */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    padding: 20px 0;
}

.card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-light);
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.6s ease-out backwards;
    text-decoration: none;
    color: inherit;
}

.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.15s; }
.card:nth-child(3) { animation-delay: 0.2s; }
.card:nth-child(4) { animation-delay: 0.25s; }
.card:nth-child(5) { animation-delay: 0.3s; }
.card:nth-child(6) { animation-delay: 0.35s; }
.card:nth-child(7) { animation-delay: 0.4s; }
.card:nth-child(8) { animation-delay: 0.45s; }
.card:nth-child(9) { animation-delay: 0.5s; }
.card:nth-child(10) { animation-delay: 0.55s; }
.card:nth-child(11) { animation-delay: 0.6s; }
.card:nth-child(12) { animation-delay: 0.65s; }
.card:nth-child(13) { animation-delay: 0.7s; }
.card:nth-child(14) { animation-delay: 0.75s; }
.card:nth-child(15) { animation-delay: 0.8s; }

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.card:hover::before {
    left: 100%;
}

.card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: var(--shadow-heavy);
}

.card-icon {
    width: 70px;
    height: 70px;
    margin: 0 auto 20px;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--white);
    transition: var(--transition);
}

.card:hover .card-icon {
    transform: rotateY(360deg);
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%);
}

.card-title {
    font-size: 1.3rem;
    color: var(--text-dark);
    margin-bottom: 10px;
    font-weight: 600;
}

.card-description {
    color: var(--text-medium);
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Tool Page Styles */
.tool-container {
    background: var(--white);
    border-radius: 20px;
    box-shadow: var(--shadow-heavy);
    padding: 40px;
    max-width: 700px;
    width: 100%;
    margin: 0 auto;
}

.tool-header {
    text-align: center;
    margin-bottom: 30px;
}

.tool-title {
    color: var(--text-dark);
    margin-bottom: 10px;
    font-size: 28px;
    font-weight: 700;
}

.tool-subtitle {
    color: var(--text-medium);
    font-size: 14px;
    font-weight: 400;
}

/* Upload Area Styles */
.upload-area {
    border: 3px dashed var(--primary-color);
    border-radius: var(--border-radius);
    padding: 40px;
    text-align: center;
    background: var(--light-bg);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 20px;
}

.upload-area:hover {
    background: #f0f2ff;
    border-color: var(--secondary-color);
}

.upload-area.dragover {
    background: #e8ebff;
    border-color: var(--secondary-color);
    transform: scale(1.02);
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

/* Form Elements */
input[type="file"] {
    display: none;
}

.file-input-label {
    color: var(--primary-color);
    font-weight: 600;
    cursor: pointer;
}

label {
    display: block;
    color: var(--text-dark);
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
}

select, input[type="text"], input[type="password"], textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-small);
    font-size: 14px;
    transition: var(--transition);
    font-family: inherit;
}

select:focus, input[type="text"]:focus, input[type="password"]:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Button Styles */
.btn {
    padding: 15px 30px;
    border: none;
    border-radius: var(--border-radius-small);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-block;
    text-align: center;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary-gradient);
    color: var(--white);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.btn-secondary {
    background: #f0f0f0;
    color: var(--text-medium);
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-danger {
    background: #ff4757;
    color: var(--white);
}

.btn-danger:hover {
    background: #ee5a6f;
}

.btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.btn-full {
    width: 100%;
}

/* Status Messages */
.status {
    margin-top: 20px;
    padding: 15px;
    border-radius: var(--border-radius-small);
    text-align: center;
    font-weight: 600;
    display: none;
}

.status.success {
    background: #d4edda;
    color: #155724;
    display: block;
}

.status.error {
    background: #f8d7da;
    color: #721c24;
    display: block;
}

.status.info {
    background: #d1ecf1;
    color: #0c5460;
    display: block;
}

/* File List Styles */
.file-list {
    margin: 20px 0;
    max-height: 300px;
    overflow-y: auto;
}

.file-list-header {
    background: var(--primary-color);
    color: var(--white);
    padding: 10px 15px;
    border-radius: var(--border-radius-small) var(--border-radius-small) 0 0;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.file-item {
    background: #f5f5f5;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    cursor: move;
    transition: var(--transition);
}

.file-item:last-child {
    border-radius: 0 0 var(--border-radius-small) var(--border-radius-small);
}

.file-item:hover {
    background: #eef0ff;
}

.file-item.dragging {
    opacity: 0.5;
    background: #d0d5ff;
}

/* Footer Styles */
footer {
    text-align: center;
    color: var(--white);
    margin-top: 50px;
    padding: 20px;
    opacity: 0.8;
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Dropdown positioning fixes */
.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: auto;
}

/* Ensure dropdown doesn't get cut off on right edge */
.dropdown:last-child .dropdown-menu {
    right: 0;
    left: auto;
}

/* Specific fixes for optimize dropdown */
#optimizeDropdown .dropdown-menu {
    min-width: 280px;
}

/* Ensure long text in dropdown items doesn't wrap */
.dropdown-item {
    white-space: nowrap;
    overflow: visible;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background: var(--white);
        width: 100%;
        text-align: center;
        transition: left 0.3s;
        box-shadow: 0 10px 27px rgba(0, 0, 0, 0.05);
        padding: 20px 0;
        gap: 0;
        max-height: calc(100vh - 70px);
        overflow-y: auto;
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-item {
        width: 100%;
        padding: 10px 0;
    }

    .hamburger {
        display: flex;
    }

    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        margin-top: 0;
    }

    .dropdown.active .dropdown-menu {
        max-height: 600px;
    }

    .dropdown-toggle::after {
        content: ' ▾';
        transition: transform 0.3s;
    }

    .dropdown.active .dropdown-toggle::after {
        transform: rotate(180deg);
        display: inline-block;
    }

    h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 20px;
    }

    .card {
        padding: 25px;
    }

    .tool-container {
        padding: 25px;
        margin: 10px;
    }

    .container {
        padding: 10px;
    }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.mb-30 { margin-bottom: 30px; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }
.hidden { display: none; }
.visible { display: block; }
