:root {
    --primary: #4f46e5;
    --primary-light: #6366f1;
    --primary-lighter: #818cf8;
    --secondary: #10b981;
    --white: #ffffff;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #1e293b;
    --darker: #0f172a;
    --light: #f8fafc;
    --gray: #94a3b8;
    --gray-light: #e2e8f0;
    --gray-lighter: #f1f5f9;
    --success: #10b981;
    --info: #3b82f6;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

body {
    background-color: var(--gray-lighter);
    color: var(--dark);
    min-height: 100vh;
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px;
}

.headerp {
    text-align: center;
    margin-bottom: 1rem;
    margin-top: -0.5rem;
    background-color: var(--white);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-sm);
    padding: 1rem 0;
}

.headerp h1 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.header .subtitle {
    font-size: 0.9rem;
    color: var(--gray);
    max-width: 700px;
    margin: 0 auto;
}

.tool-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }
    .tool-container {
        grid-template-columns: 1fr 1fr;
    }
}

.panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.panel-header {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--gray-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

@media (min-width: 768px) {
    .panel-header {
        padding: 1rem 1.5rem;
    }
}

.panel-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--darker);
    font-size: 0.9rem;
}

@media (min-width: 768px) {
    .panel-title {
        font-size: 1rem;
    }
}

.panel-actions {
    display: flex;
    gap: 0.5rem;
}

.btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
}

@media (min-width: 768px) {
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
}

.btn:hover {
    background: var(--primary-lighter);
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
}

@media (min-width: 768px) {
    .btn-sm {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
}

.btn-secondary {
    background: white;
    color: var(--primary);
    border: 1px solid var(--gray-light);
}

.btn-secondary:hover {
    background: rgba(79, 70, 229, 0.05);
    border-color: var(--primary-light);
}

.btn-success {
    background: var(--success);
}

.btn-success:hover {
    background: #0e9f72;
}

.btn-danger {
    background: var(--danger);
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.upload-section {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 768px) {
    .upload-section {
        padding: 1.5rem;
    }
}

.upload-option {
    border: 2px dashed var(--gray-light);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    background-color: rgba(241, 245, 249, 0.5);
}

@media (min-width: 768px) {
    .upload-option {
        padding: 1.5rem;
        border-radius: 10px;
    }
}

.upload-option:hover {
    border-color: var(--primary-light);
    background: rgba(79, 70, 229, 0.03);
}

.upload-icon {
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
    opacity: 0.8;
}

@media (min-width: 768px) {
    .upload-icon {
        font-size: 2rem;
        margin-bottom: 0.75rem;
    }
}

.upload-text {
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
    font-weight: 500;
    color: var(--dark);
}

@media (min-width: 768px) {
    .upload-text {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
}

.upload-subtext {
    color: var(--gray);
    font-size: 0.8rem;
}

@media (min-width: 768px) {
    .upload-subtext {
        font-size: 0.85rem;
    }
}

#file-input {
    display: none;
}

.editor-container {
    position: relative;
    min-height: 250px;
    height: 300px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--gray-lighter);
    overflow: hidden;
}

@media (min-width: 768px) {
    .editor-container {
        height: 400px;
    }
}

#image-preview {
    max-width: 100%;
    max-height: 100%;
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    object-fit: contain;
}

.crop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
}

.crop-box {
    position: absolute;
    border: 2px solid var(--primary);
    background: rgba(79, 70, 229, 0.2);
    cursor: move;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
}

.crop-handle {
    width: 10px;
    height: 10px;
    background: var(--primary);
    position: absolute;
    border-radius: 2px;
    border: 2px solid white;
}

@media (min-width: 768px) {
    .crop-handle {
        width: 12px;
        height: 12px;
    }
}

.handle-nw { top: -5px; left: -5px; cursor: nw-resize; }
.handle-ne { top: -5px; right: -5px; cursor: ne-resize; }
.handle-sw { bottom: -5px; left: -5px; cursor: sw-resize; }
.handle-se { bottom: -5px; right: -5px; cursor: se-resize; }
.handle-n { top: -5px; left: 50%; margin-left: -5px; cursor: n-resize; }
.handle-s { bottom: -5px; left: 50%; margin-left: -5px; cursor: s-resize; }
.handle-w { left: -5px; top: 50%; margin-top: -5px; cursor: w-resize; }
.handle-e { right: -5px; top: 50%; margin-top: -5px; cursor: e-resize; }

@media (min-width: 768px) {
    .handle-nw { top: -6px; left: -6px; }
    .handle-ne { top: -6px; right: -6px; }
    .handle-sw { bottom: -6px; left: -6px; }
    .handle-se { bottom: -6px; right: -6px; }
    .handle-n { top: -6px; margin-left: -6px; }
    .handle-s { bottom: -6px; margin-left: -6px; }
    .handle-w { left: -6px; margin-top: -6px; }
    .handle-e { right: -6px; margin-top: -6px; }
}

.dimension-display {
    position: absolute;
    bottom: -25px;
    left: 0;
    background: var(--primary);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    pointer-events: none;
}

@media (min-width: 768px) {
    .dimension-display {
        bottom: -30px;
        padding: 2px 8px;
        font-size: 0.75rem;
    }
}

.empty-state {
    color: var(--gray);
    text-align: center;
    padding: 1rem;
}

.empty-state i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

@media (min-width: 768px) {
    .empty-state i {
        font-size: 3rem;
        margin-bottom: 1rem;
    }
}

.controls {
    padding: 0.8rem 1rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    border-top: 1px solid var(--gray-light);
}

@media (min-width: 768px) {
    .controls {
        padding: 1rem 1.5rem;
        grid-template-columns: 1fr 1fr;
    }
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-group h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--darker);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

@media (min-width: 768px) {
    .control-group h3 {
        font-size: 0.9rem;
    }
}

.control-group h3 i {
    color: var(--primary);
}

.control-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

label {
    font-size: 0.8rem;
    color: var(--dark);
    min-width: 30px;
}

@media (min-width: 768px) {
    label {
        font-size: 0.85rem;
        min-width: 40px;
    }
}

input[type="number"] {
    padding: 0.4rem;
    border: 1px solid var(--gray-light);
    border-radius: 6px;
    width: 70px;
    font-size: 0.8rem;
}

@media (min-width: 768px) {
    input[type="number"] {
        padding: 0.5rem;
        width: 80px;
        font-size: 0.85rem;
    }
}

input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

.aspect-ratio-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.aspect-btn {
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--gray-light);
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s ease;
}

@media (min-width: 768px) {
    .aspect-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
}

.aspect-btn:hover {
    border-color: var(--primary-light);
}

.aspect-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Results Container inside Settings Panel */
.results-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.03);
    margin-top: 1rem;
    display: none;
}

.results-header {
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid var(--gray-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

@media (min-width: 768px) {
    .results-header {
        padding: 0.8rem 1rem;
    }
}

.results-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--darker);
    font-size: 0.85rem;
}

@media (min-width: 768px) {
    .results-title {
        font-size: 0.9rem;
    }
}

.result-image-container {
    padding: 0.8rem;
    text-align: center;
}

@media (min-width: 768px) {
    .result-image-container {
        padding: 1rem;
    }
}

#cropped-result {
    max-width: 100%;
    max-height: 200px;
    display: block;
    margin: 0 auto;
    border-radius: 6px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
}

@media (min-width: 768px) {
    #cropped-result {
        max-height: 250px;
    }
}

.results-footer {
    padding: 0.6rem 0.8rem;
    border-top: 1px solid var(--gray-light);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

@media (min-width: 768px) {
    .results-footer {
        padding: 0.8rem 1rem;
        gap: 0.8rem;
    }
}

/* Blog Section */
.blog-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.03);
    margin-top: 1.5rem;
    padding: 1.5rem;
}

.blog-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--darker);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.blog-content {
    display: grid;
    gap: 1rem;
}

.blog-section {
    margin-bottom: 1.5rem;
}

.blog-section h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.blog-section p {
    font-size: 0.95rem;
    color: var(--dark);
    line-height: 1.6;
    margin-bottom: 0.8rem;
}

.blog-section ul {
    padding-left: 1.2rem;
    margin-bottom: 0.8rem;
}

.blog-section li {
    font-size: 0.95rem;
    color: var(--dark);
    line-height: 1.6;
    margin-bottom: 0.3rem;
}

.toast-container {
    position: fixed;
    bottom: 15px;
    right: 15px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: calc(100% - 30px);
}

@media (min-width: 768px) {
    .toast-container {
        bottom: 20px;
        right: 20px;
        gap: 0.8rem;
        max-width: 350px;
    }
}

.toast {
    background: var(--dark);
    color: white;
    padding: 0.8rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    width: 100%;
    position: relative;
    overflow: hidden;
}

@media (min-width: 768px) {
    .toast {
        padding: 1rem;
        gap: 0.8rem;
    }
}

.toast::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.toast.success::before {
    background: var(--success);
}

.toast.error::before {
    background: var(--danger);
}

.toast.warning::before {
    background: var(--warning);
}

.toast.info::before {
    background: var(--info);
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast i {
    font-size: 1rem;
    margin-top: 2px;
}

@media (min-width: 768px) {
    .toast i {
        font-size: 1.2rem;
    }
}

.toast.success i {
    color: var(--success);
}

.toast.error i {
    color: var(--danger);
}

.toast.warning i {
    color: var(--warning);
}

.toast.info i {
    color: var(--info);
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 0.2rem;
    font-size: 0.85rem;
}

@media (min-width: 768px) {
    .toast-title {
        margin-bottom: 0.3rem;
        font-size: 0.95rem;
    }
}

.toast-message {
    font-size: 0.8rem;
    opacity: 0.9;
    line-height: 1.4;
}

@media (min-width: 768px) {
    .toast-message {
        font-size: 0.85rem;
    }
}

.toast-close {
    background: none;
    border: none;
    color: white;
    opacity: 0.7;
    cursor: pointer;
    transition: opacity 0.2s ease;
    padding: 0.2rem;
    display: flex;
    font-size: 0.8rem;
}

@media (min-width: 768px) {
    .toast-close {
        font-size: 0.9rem;
    }
}

.toast-close:hover {
    opacity: 1;
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.2);
    width: 100%;
}

.toast-progress-bar {
    height: 100%;
    background: white;
    width: 100%;
    transition: width linear;
}
@keyframes waveEffect {
0% {
box-shadow: 0 0 0 0 rgba(0, 123, 255, 0.7);
}
70% {
box-shadow: 0 0 0 10px rgba(0, 123, 255, 0);
}
100% {
box-shadow: 0 0 0 0 rgba(0, 123, 255, 0);
}
}

.wave-animate {
position: relative;
z-index: 1;
animation: waveEffect 1.5s infinite;
}
