/**
 * Color Picker from Image Tool - Comprehensive Styling
 * Responsive design with mobile-first approach
 */

/* Tool Container */
.tool-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: calc(100vh - 200px);
}

/* Tool Header */
.tool-header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 0;
}

.tool-icon {
    font-size: 4rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.tool-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 1rem;
    line-height: 1.2;
}

.tool-description {
    font-size: 1.125rem;
    color: var(--text-light);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Section Cards */
.section-card {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
    transition: var(--transition);
    opacity: 1;
    transform: translateY(0);
}

.section-card.hidden {
    opacity: 0;
    transform: translateY(-20px);
    pointer-events: none;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    max-height: 0;
    overflow: hidden;
}

.section-card:hover {
    box-shadow: var(--shadow-lg);
}

.section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--bg-light);
}

.section-header i {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.section-header h2,
.section-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.section-subheader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.section-subheader h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

/* Upload Section */
.upload-area {
    border: 3px dashed var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 3rem 2rem;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    background: var(--bg-light);
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: var(--primary-color);
    background: rgba(26, 158, 32, 0.05);
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.upload-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.upload-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.upload-content p {
    color: var(--text-light);
    margin: 0;
}

.upload-info {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-top: 1rem;
}

/* URL Upload */
.url-upload {
    margin-top: 1.5rem;
    text-align: center;
}

.url-input {
    margin-top: 1rem;
    transition: var(--transition);
}

.url-input.hidden {
    display: none;
}

.input-group {
    display: flex;
    gap: 0.5rem;
    max-width: 500px;
    margin: 0 auto;
}

.form-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 158, 32, 0.1);
}

/* Picker Grid Layout */
.picker-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 1024px) {
    .picker-grid {
        grid-template-columns: 2fr 1fr;
    }
}

/* Canvas Card */
.canvas-card {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.canvas-container {
    position: relative;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    background: #f0f0f0;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-canvas {
    max-width: 100%;
    max-height: 600px;
    cursor: crosshair;
    transition: var(--transition);
}

.crosshair {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid #ff0000;
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%);
    z-index: 10;
    background: rgba(255, 255, 255, 0.8);
}

.crosshair::before,
.crosshair::after {
    content: '';
    position: absolute;
    background: #ff0000;
}

.crosshair::before {
    width: 2px;
    height: 100%;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
}

.crosshair::after {
    width: 100%;
    height: 2px;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
}

.canvas-controls {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

/* Color Info Card */
.color-info-card {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    height: fit-content;
}

.color-preview-section {
    margin-bottom: 2rem;
}

.color-preview {
    width: 100%;
    height: 120px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    position: relative;
    overflow: hidden;
}

.preview-text {
    color: var(--text-light);
    font-size: 0.875rem;
    text-align: center;
    padding: 1rem;
}

.coordinates {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-light);
    font-family: 'Courier New', monospace;
}

/* Color Values */
.color-values {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.color-value-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.color-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.color-input-group {
    display: flex;
    gap: 0.5rem;
}

.color-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: 'Courier New', monospace;
    background: var(--bg-light);
    color: var(--text-color);
}

.copy-btn {
    padding: 0.75rem;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.copy-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

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

/* Color History */
.color-history-section {
    margin-bottom: 2rem;
}

.color-history {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 0.5rem;
    min-height: 50px;
}

.history-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-light);
    font-size: 0.875rem;
    padding: 1rem;
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
}

.history-color {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius);
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.history-color:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

.history-color::after {
    content: attr(data-hex);
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    color: var(--text-light);
    white-space: nowrap;
    opacity: 0;
    transition: var(--transition);
}

.history-color:hover::after {
    opacity: 1;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    min-height: 44px;
    justify-content: center;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

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

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

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

.btn-success:hover {
    background: #059669;
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

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

.btn-link {
    background: transparent;
    color: var(--primary-color);
    padding: 0.5rem 1rem;
    text-decoration: none;
}

.btn-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Color Actions */
.color-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 640px) {
    .color-actions {
        flex-direction: row;
    }
}

/* Image Info */
.image-info {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-left: auto;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-content {
    background: var(--white);
    padding: 3rem;
    border-radius: var(--border-radius-lg);
    text-align: center;
    max-width: 400px;
    margin: 1rem;
}

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

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

/* Notification */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
    max-width: 400px;
    animation: slideIn 0.3s ease-out;
}

.notification-content {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 1rem 1.5rem;
    border-left: 4px solid var(--primary-color);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.notification-icon {
    font-size: 1.5rem;
}

.notification-message {
    flex: 1;
    font-weight: 500;
}

.notification-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-light);
    padding: 0.25rem;
}

.notification-close:hover {
    color: var(--text-color);
}

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

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Special handling for section cards with smooth transitions */
.section-card.hidden {
    display: block !important;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .tool-container {
        padding: 1rem 0.5rem;
    }
    
    .tool-title {
        font-size: 2rem;
    }
    
    .section-card {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .canvas-container {
        min-height: 300px;
    }
    
    .canvas-controls {
        justify-content: center;
    }
    
    .color-actions {
        flex-direction: column;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .notification {
        left: 10px;
        right: 10px;
        top: 10px;
        max-width: none;
    }
}

/* Touch Devices */
@media (hover: none) and (pointer: coarse) {
    .image-canvas {
        cursor: pointer;
    }
    
    .btn:hover {
        transform: none;
    }
    
    .copy-btn:hover {
        transform: none;
    }
    
    .history-color:hover {
        transform: none;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .image-canvas {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}
