/* Reset and Base Styles */
* {
    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: #333;
    background-color: #f8f9fa;
}

/* Main Tool Container */
.css-minifier-tool {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.tool-container {
    width: 100%;
}

/* Header */
.tool-header {
    text-align: center;
    margin-bottom: 30px;
}

.tool-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.tool-header h1 i {
    color: #28a745;
}

.tool-description {
    font-size: 1.1rem;
    color: #6c757d;
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Converter Interface */
.converter-interface {
    margin-bottom: 30px;
}

.converter-card {
    background: white;
    border-radius: 8px;
    padding: 25px;
}

/* Operation Mode Section */
.operation-mode {
    margin-bottom: 25px;
}

.operation-mode h2 {
    font-size: 1.3rem;
    color: #2c3e50;
    margin-bottom: 15px;
    text-align: center;
}

.mode-options {
    display: flex;
    flex-direction: row;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.mode-option {
    display: flex;
    flex-direction: column;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mode-option:hover {
    background: #e9ecef;
}

.mode-option input[type="radio"] {
    margin-bottom: 8px;
    transform: scale(1.2);
}

.mode-label {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
}

.mode-description {
    display: none;
}

/* Converter Content */
.converter-content {
    display: block;
}

.input-section,
.output-section {
    margin-bottom: 20px;
}

.section-label {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.css-textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.2s ease;
    background: #fff;
}

.css-textarea:focus {
    outline: none;
    border-color: #28a745;
}

.css-textarea[readonly] {
    background-color: #f8f9fa;
}

/* Input Container with Integrated Upload */
.input-container {
    position: relative;
}

.input-container.dragover .css-textarea {
    border-color: #28a745;
    background: #f8fff9;
}

.btn-upload {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    font-size: 0.85rem;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    z-index: 10;
}

.btn-upload:hover {
    background: #218838;
}

.btn-upload svg {
    width: 14px;
    height: 14px;
}

/* Drag Overlay */
.drag-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(40, 167, 69, 0.1);
    border: 2px dashed #28a745;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    pointer-events: none;
}

.drag-content {
    text-align: center;
    color: #28a745;
}

.drag-content i {
    font-size: 2rem;
    margin-bottom: 10px;
    display: block;
}

.drag-content p {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

/* File Info Display */
.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #e8f5e8;
    border: 1px solid #28a745;
    border-radius: 6px;
    padding: 8px 12px;
    margin-top: 8px;
    font-size: 0.9rem;
}

.file-details {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.file-details i {
    color: #28a745;
    font-size: 1rem;
}

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

.file-size {
    color: #6c757d;
    margin-left: 8px;
}

.btn-remove-file {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 3px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 0.75rem;
}

.btn-remove-file:hover {
    background: #c82333;
}

/* Statistics */
.input-stats,
.output-stats {
    display: flex;
    gap: 15px;
    margin-top: 8px;
    font-size: 0.85rem;
    color: #6c757d;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.stat-item i {
    color: #28a745;
}

/* Output Container */
.output-container {
    position: relative;
}

.btn-copy {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    font-size: 0.85rem;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-copy:hover {
    background: #5a6268;
}

.btn-copy svg {
    width: 14px;
    height: 14px;
}

/* Controls */
.controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: #28a745;
    color: white;
}

.btn-primary:hover {
    background: #218838;
}

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

.btn-secondary:hover {
    background: #5a6268;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #138496;
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background: #e0a800;
}

/* Error Display */
.error-display {
    background: #f8d7da;
    border-radius: 6px;
    padding: 15px;
    margin: 15px 0;
}

.error-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.error-content i {
    color: #721c24;
    font-size: 1.2rem;
    margin-top: 2px;
}

.error-details h4 {
    color: #721c24;
    margin-bottom: 5px;
    font-size: 1rem;
}

.error-details p {
    color: #721c24;
    margin-bottom: 8px;
}

.error-location {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: #721c24;
    background: rgba(114, 28, 36, 0.1);
    padding: 8px;
    border-radius: 4px;
}

/* Sample Examples */
.sample-examples {
    margin-top: 25px;
}

.sample-examples h3 {
    font-size: 1.2rem;
    color: #2c3e50;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sample-examples h3 i {
    color: #ffc107;
}

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

.example-item {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.example-item:hover {
    background: #e9ecef;
}

.example-label {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.example-preview {
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    color: #6c757d;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* SEO Content Section */
.seo-content {
    background: white;
    margin-top: 30px;
    border-radius: 8px;
}

.content-container {
    padding: 30px;
}

.content-section {
    margin-bottom: 30px;
}

.content-section:last-child {
    margin-bottom: 0;
}

.content-section h2 {
    font-size: 1.8rem;
    color: #2c3e50;
    margin-bottom: 20px;
    border-bottom: 2px solid #28a745;
    padding-bottom: 10px;
}

.content-section h3 {
    font-size: 1.3rem;
    color: #2c3e50;
    margin-bottom: 12px;
    margin-top: 20px;
}

.content-section h4 {
    font-size: 1.1rem;
    color: #2c3e50;
    margin-bottom: 10px;
    margin-top: 15px;
}

.content-section p {
    color: #555;
    margin-bottom: 15px;
    line-height: 1.6;
}

.content-section ul,
.content-section ol {
    color: #555;
    padding-left: 20px;
    margin-bottom: 15px;
}

.content-section li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.content-section li strong {
    color: #2c3e50;
}

.content-section code {
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #e83e8c;
}

.content-section pre {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #2c3e50;
    overflow-x: auto;
    margin: 15px 0;
    border-left: 4px solid #28a745;
}

/* Mobile Styles */
@media (max-width: 767px) {
    .css-minifier-tool {
        padding: 15px;
    }

    .operation-mode h2 {
        font-size: 1.2rem;
        margin-bottom: 12px;
    }

    .mode-options {
        display: flex !important;
        flex-direction: row !important;
        gap: 8px;
        justify-content: space-between;
        flex-wrap: nowrap !important;
    }

    .mode-option {
        min-width: 0;
        flex: 1;
        padding: 12px 8px;
        text-align: center;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
    }

    .mode-label {
        font-size: 0.85rem;
        line-height: 1.2;
    }

    .mode-option input[type="radio"] {
        margin-bottom: 6px;
        transform: scale(1.1);
    }

    .input-stats,
    .output-stats {
        gap: 10px;
    }

    .stat-item {
        font-size: 0.8rem;
    }

    .btn-upload {
        padding: 5px 8px;
        font-size: 0.8rem;
        gap: 4px;
    }

    .btn-upload svg {
        width: 12px;
        height: 12px;
    }

    .drag-content i {
        font-size: 1.5rem;
    }

    .drag-content p {
        font-size: 1rem;
    }

    .file-info {
        padding: 6px 10px;
        font-size: 0.85rem;
    }

    .file-details {
        gap: 6px;
    }

    .file-details i {
        font-size: 0.9rem;
    }

    .file-name {
        font-size: 0.85rem;
    }

    .file-size {
        font-size: 0.75rem;
        margin-left: 6px;
    }

    .btn-remove-file {
        width: 20px;
        height: 20px;
        font-size: 0.7rem;
    }

    .processing-indicator {
        padding: 15px;
        margin: 15px 0;
    }

    .processing-content {
        gap: 12px;
    }

    .processing-spinner {
        width: 28px;
        height: 28px;
        border-width: 2px;
    }

    .processing-text {
        font-size: 0.9rem;
    }

    .processing-subtext {
        font-size: 0.8rem;
    }
}

/* Extra Small Mobile Styles */
@media (max-width: 360px) {
    .mode-options {
        gap: 6px;
    }

    .mode-option {
        padding: 10px 6px;
    }

    .mode-label {
        font-size: 0.8rem;
    }
}

/* Tablet Styles */
@media (min-width: 768px) {
    .css-minifier-tool {
        padding: 30px;
    }

    .tool-header h1 {
        font-size: 2.5rem;
    }

    .mode-options {
        gap: 20px;
    }

    .mode-option {
        flex: 1;
    }

    .controls {
        flex-direction: row;
        justify-content: center;
        gap: 15px;
        flex-wrap: wrap;
    }

    .btn {
        min-width: 140px;
    }

    .examples-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

/* Desktop Styles */
@media (min-width: 1024px) {
    .converter-card {
        padding: 35px;
    }

    .converter-content {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 25px;
        align-items: start;
    }

    .input-section,
    .output-section {
        margin-bottom: 0;
    }

    .controls {
        grid-column: 1 / -1;
        justify-content: center;
        margin: 25px 0 0 0;
    }

    .content-container {
        padding: 40px;
    }

    .examples-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Success/Error States */
.success-message {
    background: #d4edda;
    color: #155724;
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

/* Loading State */
.btn:disabled {
    opacity: 0.8;
    cursor: not-allowed;
    position: relative;
}

.btn.loading {
    opacity: 0.8;
    cursor: not-allowed;
    pointer-events: none;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    margin: auto;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.btn.loading .btn-text {
    opacity: 0;
}

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

/* Inline Processing Indicator */
.processing-indicator {
    background: linear-gradient(135deg, #f8fff9 0%, #f0fff4 100%);
    border: 1px solid #28a745;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.1);
}

.processing-indicator.show {
    opacity: 1;
    transform: translateY(0);
}

.processing-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.processing-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e9ecef;
    border-top-color: #28a745;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    flex-shrink: 0;
}

.processing-details {
    flex: 1;
}

.processing-text {
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
}

.processing-subtext {
    font-size: 0.85rem;
    color: #6c757d;
    margin: 0;
}

/* Focus Styles for Accessibility */
.btn:focus,
.css-textarea:focus,
.mode-option:focus-within {
    outline: 2px solid #28a745;
    outline-offset: 2px;
}

/* Related Tools Section */
.related-tools-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-top: 2rem;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.related-tools-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.related-tools-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 0.5rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.related-tools-header h3 i {
    color: #28a745;
}

.related-tools-header p {
    color: #6c757d;
    margin: 0;
    font-size: 0.95rem;
}

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

.related-tool-link {
    background: #f8f9fa;
    color: #2c3e50;
    text-decoration: none;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
    border: 1px solid #e9ecef;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.related-tool-link:hover {
    background: #28a745;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.2);
    border-color: #28a745;
}

.related-tool-link i {
    font-size: 1rem;
    opacity: 0.8;
}

/* Responsive Design for Related Tools */
@media (max-width: 768px) {
    .related-tools-section {
        padding: 1.5rem;
        margin-top: 1.5rem;
    }

    .related-tools-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .related-tool-link {
        padding: 0.625rem 0.75rem;
        font-size: 0.8rem;
        flex-direction: column;
        gap: 4px;
    }

    .related-tool-link i {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .related-tools-section {
        padding: 1rem;
    }

    .related-tools-grid {
        grid-template-columns: 1fr;
    }

    .related-tool-link {
        flex-direction: row;
        gap: 8px;
        justify-content: flex-start;
        text-align: left;
    }
}
