/* Glass Weight Calculator Styles */
:root {
    --primary-color: #2196f3;
    --secondary-color: #0d47a1;
    --accent-color: #64b5f6;
    --background-color: #f5f5f5;
    --card-bg: #ffffff;
    --text-color: #333333;
    --border-radius: 10px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.app-container {
    max-width: 1000px;
    width: 100%;
    background: linear-gradient(145deg, var(--card-bg), #f0f0f0);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow), inset 1px 1px 0 rgba(255, 255, 255, 0.3);
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.header {
    background: linear-gradient(to right, var(--secondary-color), var(--primary-color));
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: space-between;
}

.unit-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--accent-color);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

.unit-label {
    font-size: 0.9rem;
    font-weight: 500;
}

.logo {
    height: 50px;
    filter: brightness(1.2);
    animation: fadeIn 1s ease-in-out;
}

.header h1 {
    font-size: 1.8rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.calculator-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px;
}

.shape-selector, .input-section, .result-section {
    background: linear-gradient(145deg, #ffffff, #f5f5f5);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: 8px 8px 16px rgba(0, 0, 0, 0.1),
                -4px -4px 12px rgba(255, 255, 255, 0.8);
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.4);
    width: 100%;
    overflow: visible;
}

.shape-selector:hover, .input-section:hover, .result-section:hover {
    transform: translateY(-5px);
    box-shadow: 12px 12px 20px rgba(0, 0, 0, 0.15),
                -6px -6px 16px rgba(255, 255, 255, 0.9);
}

.weight-result {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.copy-btn {
    background: transparent;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.copy-btn:hover {
    background: rgba(33, 150, 243, 0.1);
    transform: scale(1.1);
}

.copy-btn:active {
    transform: scale(0.95);
}

.copy-btn .material-icons {
    font-size: 20px;
}

.copy-btn.copied {
    color: #4caf50;
    animation: pop 0.3s ease-in-out;
}

@keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.shape-btn {
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    padding: 15px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.1),
                -2px -2px 6px rgba(255, 255, 255, 0.8);
}

.shape-btn:hover {
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.shape-btn.active {
    background: linear-gradient(145deg, var(--primary-color), #1e88e5);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 8px rgba(33, 150, 243, 0.3), 
                inset 1px 1px 3px rgba(255, 255, 255, 0.3);
    animation: pulse 1s infinite;
    transform: translateY(-2px);
}

.shape-btn .material-icons {
    font-size: 2rem;
}

.dimensions-form {
    display: grid;
    gap: 15px;
    margin-bottom: 20px;
}

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

label {
    font-size: 0.9rem;
    color: #555;
}

input {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    transition: var(--transition);
    background: linear-gradient(145deg, #f8f8f8, #ffffff);
    box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.05), 
                inset -2px -2px 5px rgba(255, 255, 255, 0.5);
}

input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2), 
                inset 1px 1px 3px rgba(0, 0, 0, 0.05);
    outline: none;
}

.thickness-input {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.thickness-input input {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    transition: var(--transition);
    width: 100%;
}

.thickness-input input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
    outline: none;
}

.thickness-input input:hover {
    border-color: var(--accent-color);
}

.calculate-btn {
    background: linear-gradient(145deg, var(--primary-color), #1e88e5);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    transition: var(--transition);
    box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.2),
                -2px -2px 6px rgba(255, 255, 255, 0.1);
}

.calculate-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(13, 71, 161, 0.3);
}

.result-display {
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-shadow: 8px 8px 16px rgba(0, 0, 0, 0.1),
                -8px -8px 16px rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.weight-result {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--secondary-color);
}

.formula-display {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: #666;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.back-button {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-color);
    text-decoration: none;
    padding: 15px 20px;
    font-weight: 500;
    transition: var(--transition);
    border-radius: var(--border-radius);
    margin: 15px;
    border: 1px solid transparent;
    box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.08), 
                -2px -2px 6px rgba(255, 255, 255, 0.9);
    background: linear-gradient(145deg, #ffffff, #f5f5f5);
}

.back-button:hover {
    color: var(--secondary-color);
    background: rgba(33, 150, 243, 0.1);
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.back-button:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(33, 150, 243, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(33, 150, 243, 0); }
    100% { box-shadow: 0 0 0 0 rgba(33, 150, 243, 0); }
}

.result-value, .formula-text {
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.result-value.updated, .formula-text.updated {
    animation: highlight 1s ease;
}

@keyframes highlight {
    0% { background-color: rgba(33, 150, 243, 0.2); }
    100% { background-color: transparent; }
}

/* Shape Preview Styles */
.shape-preview {
    width: 100%;
    height: 150px;
    margin: 15px 0;
    border: 1px solid #ddd;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9f9f9;
    overflow: hidden;
    position: relative;
}

.preview-shape {
    transition: all 0.5s ease;
    position: relative;
}

.preview-rectangle, .preview-square, .preview-parallelogram {
    background: rgba(33, 150, 243, 0.3);
    border: 2px solid var(--primary-color);
    box-shadow: 0 0 15px rgba(33, 150, 243, 0.2);
}

.preview-circle, .preview-ellipse {
    background: rgba(33, 150, 243, 0.3);
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    box-shadow: 0 0 15px rgba(33, 150, 243, 0.2);
}

.preview-triangle {
    width: 0;
    height: 0;
    border-left: 50px solid transparent;
    border-right: 50px solid transparent;
    border-bottom: 100px solid rgba(33, 150, 243, 0.5);
    box-shadow: 0 0 15px rgba(33, 150, 243, 0.2);
}

.preview-trapezoid {
    width: 100px;
    height: 0;
    border-bottom: 60px solid rgba(33, 150, 243, 0.5);
    border-left: 25px solid transparent;
    border-right: 25px solid transparent;
    box-shadow: 0 0 15px rgba(33, 150, 243, 0.2);
}

.preview-polygon {
    position: relative;
    width: 100px;
    height: 100px;
    background: rgba(33, 150, 243, 0.3);
    clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
    box-shadow: 0 0 15px rgba(33, 150, 243, 0.2);
}

.preview-irregularPentagon {
    position: relative;
    width: 100px;
    height: 100px;
    background: rgba(33, 150, 243, 0.3);
    clip-path: polygon(30% 0%, 70% 0%, 100% 50%, 70% 100%, 30% 100%, 0% 50%);
    box-shadow: 0 0 15px rgba(33, 150, 243, 0.2);
}

/* Dimension labels in preview */
.dimension-label {
    position: absolute;
    font-size: 0.7rem;
    color: var(--secondary-color);
    font-weight: 500;
    background: rgba(255, 255, 255, 0.8);
    padding: 2px 5px;
    border-radius: 3px;
    pointer-events: none;
}

.shape-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
    padding: 15px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 100%;
    overflow: visible;
}

.shape-btn {
    width: 100%;
    min-height: 80px;
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    padding: 10px 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.1),
                -2px -2px 6px rgba(255, 255, 255, 0.8);
    overflow: hidden;
    text-align: center;
}

.shape-btn:hover {
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.shape-btn.active {
    background: linear-gradient(145deg, var(--primary-color), #1e88e5);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 8px rgba(33, 150, 243, 0.3), 
                inset 1px 1px 3px rgba(255, 255, 255, 0.3);
    animation: pulse 1s infinite;
    transform: translateY(-2px);
}

.shape-btn .material-icons {
    font-size: 2rem;
}

.dimensions-form {
    display: grid;
    gap: 15px;
    margin-bottom: 20px;
}

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

label {
    font-size: 0.9rem;
    color: #555;
}

input {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    transition: var(--transition);
    background: linear-gradient(145deg, #f8f8f8, #ffffff);
    box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.05), 
                inset -2px -2px 5px rgba(255, 255, 255, 0.5);
}

input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2), 
                inset 1px 1px 3px rgba(0, 0, 0, 0.05);
    outline: none;
}

.thickness-input {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.thickness-input input {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    transition: var(--transition);
    width: 100%;
}

.thickness-input input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
    outline: none;
}

.thickness-input input:hover {
    border-color: var(--accent-color);
}

.calculate-btn {
    background: linear-gradient(145deg, var(--primary-color), #1e88e5);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    transition: var(--transition);
    box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.2),
                -2px -2px 6px rgba(255, 255, 255, 0.1);
}

.calculate-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(13, 71, 161, 0.3);
}

.result-display {
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-shadow: 8px 8px 16px rgba(0, 0, 0, 0.1),
                -8px -8px 16px rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.weight-result {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--secondary-color);
}

.formula-display {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: #666;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.back-button {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-color);
    text-decoration: none;
    padding: 15px 20px;
    font-weight: 500;
    transition: var(--transition);
    border-radius: var(--border-radius);
    margin: 15px;
    border: 1px solid transparent;
    box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.08), 
                -2px -2px 6px rgba(255, 255, 255, 0.9);
    background: linear-gradient(145deg, #ffffff, #f5f5f5);
}

.back-button:hover {
    color: var(--secondary-color);
    background: rgba(33, 150, 243, 0.1);
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.back-button:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(33, 150, 243, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(33, 150, 243, 0); }
    100% { box-shadow: 0 0 0 0 rgba(33, 150, 243, 0); }
}

.result-value, .formula-text {
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.result-value.updated, .formula-text.updated {
    animation: highlight 1s ease;
}

@keyframes highlight {
    0% { background-color: rgba(33, 150, 243, 0.2); }
    100% { background-color: transparent; }
}

/* Shape Preview Styles */
.shape-preview {
    width: 100%;
    height: 150px;
    margin: 15px 0;
    border: 1px solid #ddd;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9f9f9;
    overflow: hidden;
    position: relative;
}

.preview-shape {
    transition: all 0.5s ease;
    position: relative;
}

.preview-rectangle, .preview-square, .preview-parallelogram {
    background: rgba(33, 150, 243, 0.3);
    border: 2px solid var(--primary-color);
    box-shadow: 0 0 15px rgba(33, 150, 243, 0.2);
}

.preview-circle, .preview-ellipse {
    background: rgba(33, 150, 243, 0.3);
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    box-shadow: 0 0 15px rgba(33, 150, 243, 0.2);
}

.preview-triangle {
    width: 0;
    height: 0;
    border-left: 50px solid transparent;
    border-right: 50px solid transparent;
    border-bottom: 100px solid rgba(33, 150, 243, 0.5);
    box-shadow: 0 0 15px rgba(33, 150, 243, 0.2);
}

.preview-trapezoid {
    width: 100px;
    height: 0;
    border-bottom: 60px solid rgba(33, 150, 243, 0.5);
    border-left: 25px solid transparent;
    border-right: 25px solid transparent;
    box-shadow: 0 0 15px rgba(33, 150, 243, 0.2);
}

.preview-polygon {
    position: relative;
    width: 100px;
    height: 100px;
    background: rgba(33, 150, 243, 0.3);
    clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
    box-shadow: 0 0 15px rgba(33, 150, 243, 0.2);
}

.preview-irregularPentagon {
    position: relative;
    width: 100px;
    height: 100px;
    background: rgba(33, 150, 243, 0.3);
    clip-path: polygon(30% 0%, 70% 0%, 100% 50%, 70% 100%, 30% 100%, 0% 50%);
    box-shadow: 0 0 15px rgba(33, 150, 243, 0.2);
}

/* Dimension labels in preview */
.dimension-label {
    position: absolute;
    font-size: 0.7rem;
    color: var(--secondary-color);
    font-weight: 500;
    background: rgba(255, 255, 255, 0.8);
    padding: 2px 5px;
    border-radius: 3px;
    pointer-events: none;
}

.shape-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    padding: 15px;
    margin-bottom: 20px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .calculator-section {
        grid-template-columns: 1fr;
        padding: 15px;
    }
    
    .header {
        flex-direction: column;
        text-align: center;
        padding: 15px;
    }

    .header h1 {
        font-size: 1.4rem;
        margin: 10px 0;
    }

    .unit-toggle {
        margin-top: 10px;
        align-self: center;
    }
    
    .logo {
        height: 40px;
    }
    
    .shape-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
        padding: 10px;
    }

    .shape-btn {
        width: 100%;
        height: auto;
        aspect-ratio: 1;
        padding: 10px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .shape-grid {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
        gap: 8px;
        padding: 8px;
    }
    
    .shape-btn {
        min-height: 60px;
        padding: 5px;
    }
    
    .input-group input {
        font-size: 14px;
        padding: 6px;
    }
    
    .result-section {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 1.2rem;
    }
    
    .logo {
        height: 30px;
    }
}

/* Polygon sides input specific styling */
.sides-input {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sides-input input {
    width: 70px;
}

.sides-control {
    display: flex;
    gap: 5px;
}

.sides-control button {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
}

.sides-control button:hover {
    background: #e0e0e0;
}

/* Error message styling */
.error-message {
    color: #d32f2f;
    font-size: 0.85rem;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
    animation: fadeIn 0.3s ease;
}