/* Volume Calculator Tool Styles */

/* Tool Container - Full Page Layout */
.volume-calculator-tool {
    width: 100%;
    min-height: 100vh;
    background: #ffffff;
    padding: 0;
    margin: 0;
}

.tool-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
}

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

.tool-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: rgb(34, 33, 33);
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.tool-header h1 i {
    color: var(--primary-color);
    font-size: 1.8rem;
}

.tool-description {
    font-size: 1rem;
    color: var(--text-light);
    margin-bottom: 0;
    line-height: 1.6;
}

/* Calculator Interface */
.calculator-interface {
    margin-bottom: 2rem;
}

.calculator-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    
    border: 1px solid #e5e7eb;
}

/* Shape Selection */
.shape-selection {
    margin-bottom: 2rem;
}

.section-label {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.75rem;
}

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

.shape-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem;
    background: #f8fafc;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-dark);
    min-height: 85px;
    text-align: center;
    word-wrap: break-word;
    hyphens: auto;
}

.shape-btn:hover {
    background: rgba(59, 130, 246, 0.05);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .shape-btn:hover {
        transform: none;
    }

    .shape-btn:active {
        background: rgba(59, 130, 246, 0.1);
        border-color: var(--primary-color);
        transform: scale(0.98);
    }
}

.shape-btn.active {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.shape-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
}

.shape-icon svg {
    transition: transform 0.2s ease;
}

.shape-btn:hover .shape-icon svg {
    transform: scale(1.1);
}

/* Input Forms */
.input-forms {
    margin-bottom: 2rem;
}

.input-form {
    display: none;
}

.input-form.active {
    display: block;
}

.form-header {
    text-align: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f3f4f6;
}

.form-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.form-header p {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 0.75rem;
}

.formula-display {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 6px;
    padding: 0.75rem;
    font-size: 0.875rem;
    color: #0369a1;
    font-family: 'Courier New', monospace;
}

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

.input-group {
    display: flex;
    flex-direction: column;
}

.input-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.input-with-unit {
    position: relative;
    display: flex;
    align-items: center;
}

.form-input {
    flex: 1;
    padding: 0.75rem;
    padding-right: 4rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s ease;
    background: white;
}

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

.unit-select {
    position: absolute;
    right: 0.5rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.875rem;
    background: white;
    color: var(--text-dark);
    cursor: pointer;
}

.unit-label {
    position: absolute;
    right: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-light);
    pointer-events: none;
}

.example-text {
    font-size: 0.875rem;
    color: var(--text-light);
    font-style: italic;
    text-align: center;
    margin-top: 0.5rem;
}

/* Action Controls */
.action-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.calculate-btn,
.clear-btn {
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.calculate-btn {
    background: rgb(20, 74, 189);
    color: white;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.3);
}

.clear-btn {
    background: #f3f4f6;
    color: var(--text-dark);
}

.clear-btn:hover {
    background: #e5e7eb;
}

.calculate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Result Section */
.result-section {
    margin-top: 2rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.result-section.show {
    opacity: 1;
    transform: translateY(0);
}

.result-display {
    background: linear-gradient(135deg, #dcfce7 0%, #c9f4fc 100%);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid #86efac;
    transition: all 0.3s ease-in-out;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid rgba(134, 239, 172, 0.3);
}

.result-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.copy-result-btn {
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(134, 239, 172, 0.3);
    border-radius: 8px;
    color: var(--primary-color);
    cursor: pointer;
    transition: all 0.2s ease;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.copy-result-btn:hover {
    background: white;
    color: var(--primary-color);
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

/* Volume Result Display */
.volume-result-container {
    text-align: center;
    margin-bottom: 2rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.volume-result-container.animate {
    opacity: 1;
    transform: translateY(0);
}

.volume-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    font-family: 'Courier New', monospace;
    transition: all 0.3s ease-in-out;
    line-height: 1;
    display: inline-block;
    margin-bottom: 0.5rem;
}

.volume-value.counting {
    color: var(--text-light);
    animation: pulse 1.5s ease-in-out infinite;
}

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

.volume-unit {
    font-size: 1.5rem;
    font-weight: 600;
    color: #374151;
    font-family: 'Courier New', monospace;
    margin-left: 0.25rem;
    line-height: 1;
    margin-bottom: 1rem;
}

/* Unit Conversions */
.unit-conversions {
    margin-bottom: 2rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.unit-conversions.animate {
    opacity: 1;
    transform: translateY(0);
}

.unit-conversions h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1rem;
    text-align: center;
}

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

.conversion-item {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(134, 239, 172, 0.3);
    border-radius: 8px;
    padding: 0.75rem;
    text-align: center;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.conversion-item:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(134, 239, 172, 0.2);
}

.conversion-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.conversion-unit {
    font-size: 0.875rem;
    color: var(--text-light);
    font-weight: 500;
}

/* Calculation Steps */
.calculation-steps {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.calculation-steps.animate {
    opacity: 1;
    transform: translateY(0);
}

.calculation-steps h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1rem;
    text-align: center;
}

.step-item {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(134, 239, 172, 0.3);
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    color: #1e40af;
    transition: all 0.3s ease;
}

.step-item:hover {
    background: white;
    transform: translateX(3px);
    box-shadow: 0 2px 8px rgba(30, 64, 175, 0.15);
}

.step-number {
    font-weight: 600;
    color: var(--primary-color);
}

/* Calculation History */
.calculation-history {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
}

.history-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.history-title i {
    color: var(--primary-color);
}

.history-list {
    margin-bottom: 1rem;
}

.history-item {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-shape {
    font-weight: 600;
    color: var(--primary-color);
}

.history-details {
    font-size: 0.875rem;
    color: var(--text-light);
}

.history-result {
    font-weight: 600;
    color: var(--text-dark);
}

.clear-history-btn {
    padding: 0.5rem 1rem;
    background: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    color: #dc2626;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.clear-history-btn:hover {
    background: #fecaca;
}

/* Popular Examples */
.popular-examples {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
}

.popular-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1.5rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.popular-title i {
    color: #f59e0b;
}

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

.example-item {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.example-item:hover {
    background: rgba(59, 130, 246, 0.05);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

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

.example-label {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}

.example-description {
    font-size: 0.75rem;
    color: var(--text-light);
}

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

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

.related-tools-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-color);
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.related-tools-header h3 i {
    color: var(--primary-color);
}

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

.related-tool-link {
    background: #f8fafc;
    color: var(--primary-color);
    text-decoration: none;
    padding: 0.875rem 1rem;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
    border: 1px solid #e5e7eb;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.related-tool-link:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

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

/* Loading, Error, and Success Messages */
.loading-indicator,
.error-message,
.success-message {
    text-align: center;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.loading-indicator {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    color: #0369a1;
}

.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
}

.success-message {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #bae6fd;
    border-top: 2px solid #0369a1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive Design - Mobile First */
@media (max-width: 768px) {
    .tool-container {
        padding: 1rem;
    }

    .tool-header h1 {
        font-size: 1.75rem;
        flex-direction: column;
        gap: 0.5rem;
    }

    .calculator-card {
        padding: 1.5rem;
    }

    .shape-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        margin-bottom: 1.25rem;
    }

    .shape-btn {
        padding: 0.5rem 0.375rem;
        font-size: 0.75rem;
        min-height: 70px;
        gap: 0.375rem;
        line-height: 1.2;
    }

    .shape-icon {
        width: 32px;
        height: 32px;
    }

    .input-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .action-controls {
        flex-direction: column;
        gap: 0.75rem;
    }

    .calculate-btn,
    .clear-btn {
        width: 100%;
        justify-content: center;
    }

    .volume-value {
        font-size: 2.5rem;
    }

    .conversions-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .conversion-item {
        padding: 0.625rem;
        gap: 0.125rem;
    }

    .conversion-value {
        font-size: 1rem;
        margin-bottom: 0.125rem;
    }

    .conversion-unit {
        font-size: 0.8rem;
    }

    .examples-grid {
        grid-template-columns: 1fr;
    }

    .result-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .history-item {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .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.75rem 0.5rem;
        font-size: 0.8rem;
        flex-direction: column;
        gap: 0.25rem;
    }
}

@media (max-width: 480px) {
    .tool-container {
        padding: 0.75rem;
    }

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

    .calculator-card {
        padding: 1rem;
    }

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

    .shape-btn {
        padding: 0.5rem 0.25rem;
        font-size: 0.7rem;
        min-height: 65px;
        gap: 0.25rem;
        line-height: 1.2;
    }

    .shape-icon {
        width: 28px;
        height: 28px;
    }

    .volume-value {
        font-size: 2rem;
    }

    .conversions-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .conversion-item {
        padding: 0.5rem;
        gap: 0.125rem;
        min-height: 60px;
        justify-content: center;
    }

    .conversion-value {
        font-size: 0.95rem;
        margin-bottom: 0.125rem;
    }

    .conversion-unit {
        font-size: 0.75rem;
    }

    .form-input {
        padding: 0.625rem;
        font-size: 0.875rem;
    }

    .unit-select {
        font-size: 0.75rem;
        padding: 0.25rem;
    }

    .related-tools-section {
        padding: 1rem;
        margin-top: 1rem;
    }

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

    .related-tool-link {
        padding: 0.75rem;
        font-size: 0.875rem;
        flex-direction: row;
        gap: 0.5rem;
    }
}

/* Extra small devices (320px and below) */
@media (max-width: 320px) {
    .shape-grid {
        gap: 0.375rem;
    }

    .shape-btn {
        padding: 0.375rem 0.125rem;
        font-size: 0.65rem;
        min-height: 60px;
        gap: 0.125rem;
        line-height: 1.1;
    }

    .shape-icon {
        width: 24px;
        height: 24px;
    }

    .calculator-card {
        padding: 0.75rem;
    }

    .conversions-grid {
        gap: 0.375rem;
    }

    .conversion-item {
        padding: 0.375rem;
        gap: 0.125rem;
        min-height: 55px;
    }

    .conversion-value {
        font-size: 0.875rem;
        margin-bottom: 0.125rem;
    }

    .conversion-unit {
        font-size: 0.7rem;
    }
}

/* Print Styles */
@media print {
    .volume-calculator-tool {
        background: white !important;
    }

    .action-controls,
    .popular-examples,
    .calculation-history {
        display: none !important;
    }

    .calculator-card,
    .result-display {
        box-shadow: none !important;
        border: 1px solid #000 !important;
    }

    .shape-btn {
        border: 1px solid #000 !important;
    }

    .volume-value {
        color: #000 !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .calculator-card,
    .result-display,
    .popular-examples,
    .calculation-history {
        border: 2px solid #000;
    }

    .shape-btn {
        border: 2px solid #000;
    }

    .shape-btn.active {
        background: #000;
        color: #fff;
    }

    .form-input {
        border: 2px solid #000;
    }

    .calculate-btn {
        background: #000;
        border: 2px solid #000;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .spinner {
        animation: none;
    }
}
